Auto merge of #118189 - compiler-errors:cache-flags-for-const, r=nnethercote
Cache flags for `ty::Const` Not sure if this has been attempted yet, but worth a shot. It does make the code simpler in `rustc_type_ir`, since we can assume that consts have a `flags` method that is no-cost. r? `@ghost`
This commit is contained in:
@@ -900,7 +900,7 @@ impl<'tcx> Term<'tcx> {
|
||||
&*((ptr & !TAG_MASK) as *const WithCachedTypeInfo<ty::TyKind<'tcx>>),
|
||||
))),
|
||||
CONST_TAG => TermKind::Const(ty::Const(Interned::new_unchecked(
|
||||
&*((ptr & !TAG_MASK) as *const ty::ConstData<'tcx>),
|
||||
&*((ptr & !TAG_MASK) as *const WithCachedTypeInfo<ty::ConstData<'tcx>>),
|
||||
))),
|
||||
_ => core::intrinsics::unreachable(),
|
||||
}
|
||||
@@ -967,7 +967,7 @@ impl<'tcx> TermKind<'tcx> {
|
||||
TermKind::Const(ct) => {
|
||||
// Ensure we can use the tag bits.
|
||||
assert_eq!(mem::align_of_val(&*ct.0.0) & TAG_MASK, 0);
|
||||
(CONST_TAG, ct.0.0 as *const ty::ConstData<'tcx> as usize)
|
||||
(CONST_TAG, ct.0.0 as *const WithCachedTypeInfo<ty::ConstData<'tcx>> as usize)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user