Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub(crate) struct MutexInternal<T> {
}

impl<T> MutexInternal<T> {
pub(crate) fn new(data: T) -> Self {
pub(crate) const fn new(data: T) -> Self {
Self {
inner: UnsafeCell::new(data),
queue: AtomicPtr::new(UNLOCKED),
Expand Down Expand Up @@ -478,7 +478,7 @@ impl<T> Mutex<T> {
/// let mutex = Mutex::new(42);
/// ```
#[inline(always)]
pub fn new(data: T) -> Self {
pub const fn new(data: T) -> Self {
Self {
internal: MutexInternal::new(data),
}
Expand Down Expand Up @@ -940,7 +940,7 @@ impl<T> AsyncMutex<T> {
/// `MutexInternal` is allocated immediately; no heap allocation is
/// performed until contention forces a queue to be created.
#[inline(always)]
pub fn new(data: T) -> Self {
pub const fn new(data: T) -> Self {
Self {
internal: MutexInternal::new(data),
}
Expand Down