diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-07-17 18:55:07 +0000 |
|---|---|---|
| committer | Pietro Albini <pietro.albini@ferrous-systems.com> | 2023-07-31 12:44:19 +0200 |
| commit | efcd08eb357c7fa34ff185e660bc6e41d81f7da8 (patch) | |
| tree | ea7bcdc38e2b906539833ea23c4204c623b8df8d | |
| parent | 8ede3aae28fe6e4d52b38157d7bfe0d3bceef225 (diff) | |
| download | rust-efcd08eb357c7fa34ff185e660bc6e41d81f7da8.tar.gz rust-efcd08eb357c7fa34ff185e660bc6e41d81f7da8.zip | |
Substitute types before checking compatibility.
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index ca1e209d504..233de6dc65f 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -437,6 +437,10 @@ impl<'tcx> Inliner<'tcx> { validation: Ok(()), }; + for var_debug_info in callee_body.var_debug_info.iter() { + checker.visit_var_debug_info(var_debug_info); + } + // Traverse the MIR manually so we can account for the effects of inlining on the CFG. let mut work_list = vec![START_BLOCK]; let mut visited = BitSet::new_empty(callee_body.basic_blocks.len()); @@ -845,7 +849,16 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> { let parent = Place { local, projection: self.tcx.mk_place_elems(proj_base) }; let parent_ty = parent.ty(&self.callee_body.local_decls, self.tcx); let check_equal = |this: &mut Self, f_ty| { - if !util::is_equal_up_to_subtyping(this.tcx, this.param_env, ty, f_ty) { + // Fast path if there is nothing to substitute. + if ty == f_ty { + return; + } + let ty = this.instance.subst_mir(this.tcx, ty::EarlyBinder(&ty)); + let f_ty = this.instance.subst_mir(this.tcx, ty::EarlyBinder(&f_ty)); + if ty == f_ty { + return; + } + if !util::is_subtype(this.tcx, this.param_env, ty, f_ty) { trace!(?ty, ?f_ty); this.validation = Err("failed to normalize projection type"); return; |
