correctly intern List<Const<'tcx>>

This commit is contained in:
Boxy 2022-11-23 09:25:01 +00:00 committed by kadmin
parent 5a496aab03
commit 95e1a39c04

View File

@ -137,6 +137,7 @@ pub struct CtxtInterners<'tcx> {
// Specifically use a speedy hash algorithm for these hash sets, since
// they're accessed quite often.
type_: InternedSet<'tcx, WithStableHash<TyS<'tcx>>>,
const_lists: InternedSet<'tcx, List<ty::Const<'tcx>>>,
substs: InternedSet<'tcx, InternalSubsts<'tcx>>,
canonical_var_infos: InternedSet<'tcx, List<CanonicalVarInfo<'tcx>>>,
region: InternedSet<'tcx, RegionKind<'tcx>>,
@ -157,6 +158,7 @@ impl<'tcx> CtxtInterners<'tcx> {
CtxtInterners {
arena,
type_: Default::default(),
const_lists: Default::default(),
substs: Default::default(),
region: Default::default(),
poly_existential_predicates: Default::default(),
@ -2261,6 +2263,7 @@ macro_rules! slice_interners {
}
slice_interners!(
const_lists: _intern_const_list(Const<'tcx>),
substs: _intern_substs(GenericArg<'tcx>),
canonical_var_infos: _intern_canonical_var_infos(CanonicalVarInfo<'tcx>),
poly_existential_predicates:
@ -2722,7 +2725,7 @@ impl<'tcx> TyCtxt<'tcx> {
}
pub fn intern_const_list(self, cs: &[ty::Const<'tcx>]) -> &'tcx List<ty::Const<'tcx>> {
if cs.is_empty() { List::empty() } else { List::from_arena(self.arena, cs) }
if cs.is_empty() { List::empty() } else { self._intern_const_list(cs) }
}
pub fn intern_type_list(self, ts: &[Ty<'tcx>]) -> &'tcx List<Ty<'tcx>> {