Auto merge of #85892 - tmiasko:i, r=oli-obk
Miscellaneous inlining improvements
This commit is contained in:
@@ -93,6 +93,7 @@ pub struct Generics {
|
||||
}
|
||||
|
||||
impl<'tcx> Generics {
|
||||
#[inline]
|
||||
pub fn count(&self) -> usize {
|
||||
self.parent_count + self.params.len()
|
||||
}
|
||||
|
||||
@@ -37,9 +37,11 @@ pub struct List<T> {
|
||||
|
||||
unsafe impl<'a, T: 'a> rustc_data_structures::tagged_ptr::Pointer for &'a List<T> {
|
||||
const BITS: usize = std::mem::align_of::<usize>().trailing_zeros() as usize;
|
||||
#[inline]
|
||||
fn into_usize(self) -> usize {
|
||||
self as *const List<T> as usize
|
||||
}
|
||||
#[inline]
|
||||
unsafe fn from_usize(ptr: usize) -> Self {
|
||||
&*(ptr as *const List<T>)
|
||||
}
|
||||
|
||||
@@ -1097,12 +1097,14 @@ pub struct ParamEnv<'tcx> {
|
||||
|
||||
unsafe impl rustc_data_structures::tagged_ptr::Tag for traits::Reveal {
|
||||
const BITS: usize = 1;
|
||||
#[inline]
|
||||
fn into_usize(self) -> usize {
|
||||
match self {
|
||||
traits::Reveal::UserFacing => 0,
|
||||
traits::Reveal::All => 1,
|
||||
}
|
||||
}
|
||||
#[inline]
|
||||
unsafe fn from_usize(ptr: usize) -> Self {
|
||||
match ptr {
|
||||
0 => traits::Reveal::UserFacing,
|
||||
@@ -1200,6 +1202,7 @@ impl<'tcx> ParamEnv<'tcx> {
|
||||
}
|
||||
|
||||
/// Returns this same environment but with no caller bounds.
|
||||
#[inline]
|
||||
pub fn without_caller_bounds(self) -> Self {
|
||||
Self::new(List::empty(), self.reveal())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user