//! type context book-keeping
use crate::dep_graph::DepGraph;
-use crate::dep_graph::{DepNode, DepConstructor};
+use crate::dep_graph::{self, DepNode, DepConstructor};
use crate::errors::DiagnosticBuilder;
use crate::session::Session;
use crate::session::config::{BorrowckMode, OutputFilenames};
goal: InternedSet<'tcx, GoalKind<'tcx>>,
goal_list: InternedSet<'tcx, List<Goal<'tcx>>>,
projs: InternedSet<'tcx, List<ProjectionKind<'tcx>>>,
+ lazy_const: InternedSet<'tcx, LazyConst<'tcx>>,
}
impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
goal: Default::default(),
goal_list: Default::default(),
projs: Default::default(),
+ lazy_const: Default::default(),
}
}
self.global_arenas.adt_def.alloc(def)
}
- pub fn intern_const_alloc(
- self,
- alloc: Allocation,
- ) -> &'gcx Allocation {
+ pub fn intern_const_alloc(self, alloc: Allocation) -> &'gcx Allocation {
self.allocation_interner.borrow_mut().intern(alloc, |alloc| {
self.global_arenas.const_allocs.alloc(alloc)
})
})
}
- pub fn intern_lazy_const(self, c: ty::LazyConst<'tcx>) -> &'tcx ty::LazyConst<'tcx> {
- self.global_interners.arena.alloc(c)
- }
-
pub fn intern_layout(self, layout: LayoutDetails) -> &'gcx LayoutDetails {
self.layout_interner.borrow_mut().intern(layout, |layout| {
self.global_arenas.layout.alloc(layout)
self.dep_graph.with_task(dep_node,
self,
crate_hash,
- |_, x| x // No transformation needed
+ |_, x| x, // No transformation needed
+ dep_graph::hash_result,
);
}
}
}
}
+impl<'tcx: 'lcx, 'lcx> Borrow<LazyConst<'lcx>> for Interned<'tcx, LazyConst<'tcx>> {
+ fn borrow<'a>(&'a self) -> &'a LazyConst<'lcx> {
+ &self.0
+ }
+}
+
impl<'tcx: 'lcx, 'lcx> Borrow<[ExistentialPredicate<'lcx>]>
for Interned<'tcx, List<ExistentialPredicate<'tcx>>> {
fn borrow<'a>(&'a self) -> &'a [ExistentialPredicate<'lcx>] {
direct_interners!('tcx,
region: mk_region(|r: &RegionKind| r.keep_in_local_tcx()) -> RegionKind,
- goal: mk_goal(|c: &GoalKind<'_>| keep_local(c)) -> GoalKind<'tcx>
+ goal: mk_goal(|c: &GoalKind<'_>| keep_local(c)) -> GoalKind<'tcx>,
+ lazy_const: mk_lazy_const(|c: &LazyConst<'_>| keep_local(&c)) -> LazyConst<'tcx>
);
macro_rules! slice_interners {
#[inline]
pub fn mk_array(self, ty: Ty<'tcx>, n: u64) -> Ty<'tcx> {
- self.mk_ty(Array(ty, self.intern_lazy_const(
+ self.mk_ty(Array(ty, self.mk_lazy_const(
ty::LazyConst::Evaluated(ty::Const::from_usize(self.global_tcx(), n))
)))
}