Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Jul 15, 2022
1 parent 4845b35 commit b8bbee6
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ty::ConstnessArg>) -> GenericArg<'tcx> {
match param.kind {
GenericParamDefKind::Lifetime => {
// Create a region inference variable for the given
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions compiler/rustc_infer/src/infer/outlives/test_type_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
5 changes: 2 additions & 3 deletions compiler/rustc_middle/src/mir/interpret/queries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand All @@ -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))
}
Expand Down
4 changes: 4 additions & 0 deletions compiler/rustc_middle/src/ty/visit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ pub trait TypeVisitor<'tcx>: Sized {
fn visit_mir_const(&mut self, c: mir::ConstantKind<'tcx>) -> ControlFlow<Self::BreakTy> {
c.super_visit_with(self)
}

fn visit_constness_arg(&mut self, c: ty::ConstnessArg) -> ControlFlow<Self::BreakTy> {
c.super_visit_with(self)
}
}

///////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit b8bbee6

Please sign in to comment.