Skip to content

Commit f925ea0

Browse files
committed
remove const trait impl
1 parent 1435c15 commit f925ea0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

compiler/rustc_data_structures/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#![feature(unwrap_infallible)]
3232
#![feature(strict_provenance)]
3333
#![feature(ptr_alignment_type)]
34-
#![feature(const_ptr_as_ref)]
3534
#![allow(rustc::default_hash_types)]
3635
#![allow(rustc::potential_query_instability)]
3736
#![deny(rustc::untranslatable_diagnostic)]

compiler/rustc_data_structures/src/sync.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ pub use std::sync::OnceLock as OnceCell;
352352

353353
pub use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, AtomicUsize};
354354

355-
pub type MTRef<'a, T> = &'a T;
355+
pub type MTLockRef<'a, T> = &'a MTLock<T>;
356356

357357
#[derive(Debug, Default)]
358358
pub struct MTLock<T>(Lock<T>);
@@ -422,9 +422,10 @@ unsafe impl<T: DynSend> Send for FromDyn<T> {}
422422
#[cfg(parallel_compiler)]
423423
unsafe impl<T: DynSync> Sync for FromDyn<T> {}
424424

425-
impl<T> const std::ops::Deref for FromDyn<T> {
425+
impl<T> std::ops::Deref for FromDyn<T> {
426426
type Target = T;
427427

428+
#[inline(always)]
428429
fn deref(&self) -> &Self::Target {
429430
&self.0
430431
}
@@ -564,23 +565,25 @@ pub struct LockGuard<'a, T> {
564565
marker: PhantomData<&'a mut T>,
565566
}
566567

567-
impl<T> const Deref for LockGuard<'_, T> {
568+
impl<T> Deref for LockGuard<'_, T> {
568569
type Target = T;
569570

571+
#[inline(always)]
570572
fn deref(&self) -> &T {
571573
unsafe { &*self.lock.data.get() }
572574
}
573575
}
574576

575-
impl<T> const DerefMut for LockGuard<'_, T> {
577+
impl<T> DerefMut for LockGuard<'_, T> {
578+
#[inline(always)]
576579
fn deref_mut(&mut self) -> &mut T {
577580
unsafe { &mut *self.lock.data.get() }
578581
}
579582
}
580583

581584
#[inline(never)]
582-
unsafe fn unlock_mt<T>(guard: &mut LockGuard<'_, T>) {
583-
guard.lock.mutex.unlock()
585+
fn unlock_mt<T>(guard: &mut LockGuard<'_, T>) {
586+
unsafe { guard.lock.mutex.unlock() }
584587
}
585588

586589
impl<'a, T> Drop for LockGuard<'a, T> {
@@ -590,7 +593,7 @@ impl<'a, T> Drop for LockGuard<'a, T> {
590593
debug_assert!(self.lock.borrow.get());
591594
self.lock.borrow.set(false);
592595
} else {
593-
unsafe { unlock_mt(self) }
596+
unlock_mt(self)
594597
}
595598
}
596599
}

0 commit comments

Comments
 (0)