Add intern table for List<PlaceElem<'tcx>>
This commit is contained in:
parent
190802cfca
commit
a19aed2226
@ -21,7 +21,7 @@
|
|||||||
use crate::middle::lang_items;
|
use crate::middle::lang_items;
|
||||||
use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault};
|
use crate::middle::resolve_lifetime::{self, ObjectLifetimeDefault};
|
||||||
use crate::middle::stability;
|
use crate::middle::stability;
|
||||||
use crate::mir::{Body, interpret, ProjectionKind, Promoted};
|
use crate::mir::{Body, interpret, PlaceElem, ProjectionKind, Promoted};
|
||||||
use crate::mir::interpret::{ConstValue, Allocation, Scalar};
|
use crate::mir::interpret::{ConstValue, Allocation, Scalar};
|
||||||
use crate::ty::subst::{GenericArg, InternalSubsts, SubstsRef, Subst};
|
use crate::ty::subst::{GenericArg, InternalSubsts, SubstsRef, Subst};
|
||||||
use crate::ty::ReprOptions;
|
use crate::ty::ReprOptions;
|
||||||
@ -106,6 +106,7 @@ pub struct CtxtInterners<'tcx> {
|
|||||||
goal: InternedSet<'tcx, GoalKind<'tcx>>,
|
goal: InternedSet<'tcx, GoalKind<'tcx>>,
|
||||||
goal_list: InternedSet<'tcx, List<Goal<'tcx>>>,
|
goal_list: InternedSet<'tcx, List<Goal<'tcx>>>,
|
||||||
projs: InternedSet<'tcx, List<ProjectionKind>>,
|
projs: InternedSet<'tcx, List<ProjectionKind>>,
|
||||||
|
place_elems: InternedSet<'tcx, List<PlaceElem<'tcx>>>,
|
||||||
const_: InternedSet<'tcx, Const<'tcx>>,
|
const_: InternedSet<'tcx, Const<'tcx>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,6 +125,7 @@ fn new(arena: &'tcx SyncDroplessArena) -> CtxtInterners<'tcx> {
|
|||||||
goal: Default::default(),
|
goal: Default::default(),
|
||||||
goal_list: Default::default(),
|
goal_list: Default::default(),
|
||||||
projs: Default::default(),
|
projs: Default::default(),
|
||||||
|
place_elems: Default::default(),
|
||||||
const_: Default::default(),
|
const_: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2145,6 +2147,13 @@ fn borrow(&self) -> &[ProjectionKind] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'tcx> Borrow<[PlaceElem<'tcx>]>
|
||||||
|
for Interned<'tcx, List<PlaceElem<'tcx>>> {
|
||||||
|
fn borrow(&self) -> &[PlaceElem<'tcx>] {
|
||||||
|
&self.0[..]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'tcx> Borrow<RegionKind> for Interned<'tcx, RegionKind> {
|
impl<'tcx> Borrow<RegionKind> for Interned<'tcx, RegionKind> {
|
||||||
fn borrow(&self) -> &RegionKind {
|
fn borrow(&self) -> &RegionKind {
|
||||||
&self.0
|
&self.0
|
||||||
@ -2245,7 +2254,8 @@ pub fn $method(self, v: &[$ty]) -> &'tcx List<$ty> {
|
|||||||
predicates: _intern_predicates(Predicate<'tcx>),
|
predicates: _intern_predicates(Predicate<'tcx>),
|
||||||
clauses: _intern_clauses(Clause<'tcx>),
|
clauses: _intern_clauses(Clause<'tcx>),
|
||||||
goal_list: _intern_goals(Goal<'tcx>),
|
goal_list: _intern_goals(Goal<'tcx>),
|
||||||
projs: _intern_projs(ProjectionKind)
|
projs: _intern_projs(ProjectionKind),
|
||||||
|
place_elems: _intern_place_elems(PlaceElem<'tcx>)
|
||||||
);
|
);
|
||||||
|
|
||||||
impl<'tcx> TyCtxt<'tcx> {
|
impl<'tcx> TyCtxt<'tcx> {
|
||||||
@ -2631,6 +2641,14 @@ pub fn intern_projs(self, ps: &[ProjectionKind]) -> &'tcx List<ProjectionKind> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn intern_place_elems(self, ts: &[PlaceElem<'tcx>]) -> &'tcx List<PlaceElem<'tcx>> {
|
||||||
|
if ts.len() == 0 {
|
||||||
|
List::empty()
|
||||||
|
} else {
|
||||||
|
self._intern_place_elems(ts)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn intern_canonical_var_infos(self, ts: &[CanonicalVarInfo]) -> CanonicalVarInfos<'tcx> {
|
pub fn intern_canonical_var_infos(self, ts: &[CanonicalVarInfo]) -> CanonicalVarInfos<'tcx> {
|
||||||
if ts.len() == 0 {
|
if ts.len() == 0 {
|
||||||
List::empty()
|
List::empty()
|
||||||
|
Loading…
Reference in New Issue
Block a user