Skip to content

Commit efcd08e

Browse files
cjgillotpietroalbini
authored andcommitted
Substitute types before checking compatibility.
1 parent 8ede3aa commit efcd08e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

compiler/rustc_mir_transform/src/inline.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,10 @@ impl<'tcx> Inliner<'tcx> {
437437
validation: Ok(()),
438438
};
439439

440+
for var_debug_info in callee_body.var_debug_info.iter() {
441+
checker.visit_var_debug_info(var_debug_info);
442+
}
443+
440444
// Traverse the MIR manually so we can account for the effects of inlining on the CFG.
441445
let mut work_list = vec![START_BLOCK];
442446
let mut visited = BitSet::new_empty(callee_body.basic_blocks.len());
@@ -845,7 +849,16 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
845849
let parent = Place { local, projection: self.tcx.mk_place_elems(proj_base) };
846850
let parent_ty = parent.ty(&self.callee_body.local_decls, self.tcx);
847851
let check_equal = |this: &mut Self, f_ty| {
848-
if !util::is_equal_up_to_subtyping(this.tcx, this.param_env, ty, f_ty) {
852+
// Fast path if there is nothing to substitute.
853+
if ty == f_ty {
854+
return;
855+
}
856+
let ty = this.instance.subst_mir(this.tcx, ty::EarlyBinder(&ty));
857+
let f_ty = this.instance.subst_mir(this.tcx, ty::EarlyBinder(&f_ty));
858+
if ty == f_ty {
859+
return;
860+
}
861+
if !util::is_subtype(this.tcx, this.param_env, ty, f_ty) {
849862
trace!(?ty, ?f_ty);
850863
this.validation = Err("failed to normalize projection type");
851864
return;

0 commit comments

Comments
 (0)