From b8bbee6273192809396aa4a0cbbdb4a9e5301dea Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Fri, 15 Jul 2022 06:31:52 +0000 Subject: [PATCH] fixup --- compiler/rustc_infer/src/infer/mod.rs | 4 ++-- .../rustc_infer/src/infer/outlives/test_type_match.rs | 9 +++++++++ compiler/rustc_middle/src/mir/interpret/queries.rs | 5 ++--- compiler/rustc_middle/src/ty/visit.rs | 4 ++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 20b5c8d43e014..6e763f8189509 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -1155,7 +1155,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { self.next_region_var_in_universe(RegionVariableOrigin::Nll(origin), universe) } - pub fn var_for_def(&self, span: Span, param: &ty::GenericParamDef) -> GenericArg<'tcx> { + pub fn var_for_def(&self, span: Span, param: &ty::GenericParamDef, constness: Option) -> GenericArg<'tcx> { match param.kind { GenericParamDefKind::Lifetime => { // Create a region inference variable for the given @@ -1206,7 +1206,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { /// Given a set of generics defined on a type or impl, returns a substitution mapping each /// type/region parameter to a fresh inference variable. pub fn fresh_substs_for_item(&self, span: Span, def_id: DefId) -> SubstsRef<'tcx> { - InternalSubsts::for_item(self.tcx, def_id, |param, _| self.var_for_def(span, param)) + InternalSubsts::for_item(self.tcx, def_id, |param, _| self.var_for_def(span, param, None)) } /// Returns `true` if errors have been reported since this infcx was diff --git a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs index 772e297b7b445..1f13828eb99a9 100644 --- a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs +++ b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs @@ -204,4 +204,13 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> { self.pattern_depth.shift_out(1); result } + + fn constness_args( + &mut self, + a: ty::ConstnessArg, + b: ty::ConstnessArg, + ) -> RelateResult<'tcx, ty::ConstnessArg> { + // TODO + relate::super_relate_constness(self, a, b) + } } diff --git a/compiler/rustc_middle/src/mir/interpret/queries.rs b/compiler/rustc_middle/src/mir/interpret/queries.rs index 8f6be48e563a7..07fb341cd5612 100644 --- a/compiler/rustc_middle/src/mir/interpret/queries.rs +++ b/compiler/rustc_middle/src/mir/interpret/queries.rs @@ -180,8 +180,7 @@ impl<'tcx> TyCtxtEnsure<'tcx> { let substs = InternalSubsts::identity_for_item(self.tcx, def_id); let instance = ty::Instance::new(def_id, substs); let cid = GlobalId { instance, promoted: None }; - let param_env = - self.tcx.param_env(def_id).with_reveal_all_normalized(self.tcx).with_const(); + let param_env = self.tcx.param_env(def_id).with_reveal_all_normalized(self.tcx); // Const-eval shouldn't depend on lifetimes at all, so we can erase them, which should // improve caching of queries. let inputs = self.tcx.erase_regions(param_env.and(cid)); @@ -194,7 +193,7 @@ impl<'tcx> TyCtxtEnsure<'tcx> { assert!(self.tcx.is_static(def_id)); let instance = ty::Instance::mono(self.tcx, def_id); let gid = GlobalId { instance, promoted: None }; - let param_env = ty::ParamEnv::reveal_all().with_const(); + let param_env = ty::ParamEnv::reveal_all(); trace!("eval_to_allocation: Need to compute {:?}", gid); self.eval_to_allocation_raw(param_env.and(gid)) } diff --git a/compiler/rustc_middle/src/ty/visit.rs b/compiler/rustc_middle/src/ty/visit.rs index 5365067209af9..9b2bf3d353de9 100644 --- a/compiler/rustc_middle/src/ty/visit.rs +++ b/compiler/rustc_middle/src/ty/visit.rs @@ -210,6 +210,10 @@ pub trait TypeVisitor<'tcx>: Sized { fn visit_mir_const(&mut self, c: mir::ConstantKind<'tcx>) -> ControlFlow { c.super_visit_with(self) } + + fn visit_constness_arg(&mut self, c: ty::ConstnessArg) -> ControlFlow { + c.super_visit_with(self) + } } ///////////////////////////////////////////////////////////////////////////