X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_middle%2Fsrc%2Fty%2Fcontext.rs;h=9205a8a0ffed801859efae523f76cceaa6aa4b60;hb=41883fd19a174b8c2d23494a24edd5b92b959fc6;hp=c680eeb1fdaf088ccb4888d9d165e0fe02033561;hpb=252741673b9c2b06267cd3a036d77489e92f963a;p=rust.git diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index c680eeb1fda..9205a8a0ffe 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -17,6 +17,7 @@ }; use crate::thir::Thir; use crate::traits; +use crate::traits::solve::{ExternalConstraints, ExternalConstraintsData}; use crate::ty::query::{self, TyCtxtAt}; use crate::ty::{ self, AdtDef, AdtDefData, AdtKind, Binder, Const, ConstData, DefIdTree, FloatTy, FloatVar, @@ -77,6 +78,8 @@ use std::mem; use std::ops::{Bound, Deref}; +const TINY_CONST_EVAL_LIMIT: Limit = Limit(20); + pub trait OnDiskCache<'tcx>: rustc_data_structures::sync::Sync { /// Creates a new `OnDiskCache` instance from the serialized data in `data`. fn new(sess: &'tcx Session, data: Mmap, start_pos: usize) -> Self @@ -146,6 +149,7 @@ pub struct CtxtInterners<'tcx> { bound_variable_kinds: InternedSet<'tcx, List>, layout: InternedSet<'tcx, LayoutS>, adt_def: InternedSet<'tcx, AdtDefData>, + external_constraints: InternedSet<'tcx, ExternalConstraintsData<'tcx>>, } impl<'tcx> CtxtInterners<'tcx> { @@ -167,6 +171,7 @@ fn new(arena: &'tcx WorkerLocal>) -> CtxtInterners<'tcx> { bound_variable_kinds: Default::default(), layout: Default::default(), adt_def: Default::default(), + external_constraints: Default::default(), } } @@ -1104,7 +1109,11 @@ pub fn move_size_limit(self) -> Limit { } pub fn const_eval_limit(self) -> Limit { - self.limits(()).const_eval_limit + if self.sess.opts.unstable_opts.tiny_const_eval_limit { + TINY_CONST_EVAL_LIMIT + } else { + self.limits(()).const_eval_limit + } } pub fn all_traits(self) -> impl Iterator + 'tcx { @@ -1443,6 +1452,7 @@ pub fn $method(self, v: $ty) -> $ret_ty { const_allocation: intern_const_alloc(Allocation): ConstAllocation -> ConstAllocation<'tcx>, layout: intern_layout(LayoutS): Layout -> Layout<'tcx>, adt_def: intern_adt_def(AdtDefData): AdtDef -> AdtDef<'tcx>, + external_constraints: intern_external_constraints(ExternalConstraintsData<'tcx>): ExternalConstraints -> ExternalConstraints<'tcx>, } macro_rules! slice_interners { @@ -2157,10 +2167,7 @@ pub fn named_region(self, id: HirId) -> Option { } pub fn is_late_bound(self, id: HirId) -> bool { - self.is_late_bound_map(id.owner.def_id).map_or(false, |set| { - let def_id = self.hir().local_def_id(id); - set.contains(&def_id) - }) + self.is_late_bound_map(id.owner).map_or(false, |set| set.contains(&id.local_id)) } pub fn late_bound_vars(self, id: HirId) -> &'tcx List { @@ -2168,7 +2175,7 @@ pub fn late_bound_vars(self, id: HirId) -> &'tcx List { self.late_bound_vars_map(id.owner) .and_then(|map| map.get(&id.local_id).cloned()) .unwrap_or_else(|| { - bug!("No bound vars found for {:?} ({:?})", self.hir().node_to_string(id), id) + bug!("No bound vars found for {}", self.hir().node_to_string(id)) }) .iter(), )