update TypeFlags to deal with missing ct substs
This commit is contained in:
@@ -120,7 +120,7 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
|
||||
.predicates_of(def_id.to_def_id())
|
||||
.predicates
|
||||
.iter()
|
||||
.filter_map(|(p, _)| if p.is_global() { Some(*p) } else { None });
|
||||
.filter_map(|(p, _)| if p.is_global(tcx) { Some(*p) } else { None });
|
||||
if traits::impossible_predicates(
|
||||
tcx,
|
||||
traits::elaborate_predicates(tcx, predicates).map(|o| o.predicate).collect(),
|
||||
@@ -132,6 +132,7 @@ impl<'tcx> MirPass<'tcx> for ConstProp {
|
||||
trace!("ConstProp starting for {:?}", def_id);
|
||||
|
||||
let dummy_body = &Body::new(
|
||||
tcx,
|
||||
body.source,
|
||||
body.basic_blocks().clone(),
|
||||
body.source_scopes.clone(),
|
||||
@@ -468,7 +469,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||
/// Returns the value, if any, of evaluating `c`.
|
||||
fn eval_constant(&mut self, c: &Constant<'tcx>, source_info: SourceInfo) -> Option<OpTy<'tcx>> {
|
||||
// FIXME we need to revisit this for #67176
|
||||
if c.needs_subst() {
|
||||
if c.needs_subst(self.tcx) {
|
||||
return None;
|
||||
}
|
||||
|
||||
@@ -488,9 +489,9 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||
}) => true,
|
||||
// Out of backwards compatibility we cannot report hard errors in unused
|
||||
// generic functions using associated constants of the generic parameters.
|
||||
_ => c.literal.needs_subst(),
|
||||
_ => c.literal.needs_subst(*tcx),
|
||||
},
|
||||
ConstantKind::Val(_, ty) => ty.needs_subst(),
|
||||
ConstantKind::Val(_, ty) => ty.needs_subst(*tcx),
|
||||
};
|
||||
if lint_only {
|
||||
// Out of backwards compatibility we cannot report hard errors in unused
|
||||
@@ -720,7 +721,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
|
||||
}
|
||||
|
||||
// FIXME we need to revisit this for #67176
|
||||
if rvalue.needs_subst() {
|
||||
if rvalue.needs_subst(self.tcx) {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ crate fn mir_callgraph_reachable(
|
||||
// FIXME: A not fully substituted drop shim can cause ICEs if one attempts to
|
||||
// have its MIR built. Likely oli-obk just screwed up the `ParamEnv`s, so this
|
||||
// needs some more analysis.
|
||||
if callee.needs_subst() {
|
||||
if callee.needs_subst(tcx) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +400,7 @@ fn inner_mir_for_ctfe(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -
|
||||
}
|
||||
}
|
||||
|
||||
debug_assert!(!body.has_free_regions(), "Free regions in MIR for CTFE");
|
||||
debug_assert!(!body.has_free_regions(tcx), "Free regions in MIR for CTFE");
|
||||
|
||||
body
|
||||
}
|
||||
@@ -594,7 +594,7 @@ fn inner_optimized_mir(tcx: TyCtxt<'_>, did: LocalDefId) -> Body<'_> {
|
||||
tcx.mir_drops_elaborated_and_const_checked(ty::WithOptConstParam::unknown(did)).steal();
|
||||
run_optimization_passes(tcx, &mut body);
|
||||
|
||||
debug_assert!(!body.has_free_regions(), "Free regions in optimized MIR");
|
||||
debug_assert!(!body.has_free_regions(tcx), "Free regions in optimized MIR");
|
||||
|
||||
body
|
||||
}
|
||||
@@ -621,7 +621,7 @@ fn promoted_mir<'tcx>(
|
||||
run_post_borrowck_cleanup_passes(tcx, body);
|
||||
}
|
||||
|
||||
debug_assert!(!promoted.has_free_regions(), "Free regions in promoted MIR");
|
||||
debug_assert!(!promoted.has_free_regions(tcx), "Free regions in promoted MIR");
|
||||
|
||||
tcx.arena.alloc(promoted)
|
||||
}
|
||||
|
||||
@@ -992,6 +992,7 @@ pub fn promote_candidates<'tcx>(
|
||||
scope.parent_scope = None;
|
||||
|
||||
let promoted = Body::new(
|
||||
tcx,
|
||||
body.source, // `promoted` gets filled in below
|
||||
IndexVec::new(),
|
||||
IndexVec::from_elem_n(scope, 1),
|
||||
|
||||
Reference in New Issue
Block a user