about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/inline.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-12 03:05:01 +0000
committerbors <bors@rust-lang.org>2023-08-12 03:05:01 +0000
commitd1fa3e4de38d117c94e1cf0807ed629f679e0cab (patch)
tree3559e983bf46807f9e245684d15b160155c08ae1 /compiler/rustc_mir_transform/src/inline.rs
parentd8fd588afa24f6fa5259a01b815912710713d62f (diff)
parent4d0501412a3216ee4a495e071f4b5fdf43f56c4e (diff)
Auto merge of #114748 - cuviper:beta-next, r=cuviper
[beta] backport

* Restrict linker version script of proc-macro crates to just its two symbols #114470
* bootstrap: config: fix version comparison bug #114440
* lint/ctypes: only try normalize #113921
* Avoid tls access while iterating through mpsc thread entries #113861
* Substitute types before checking inlining compatibility. #113802
* Revert "fix: bug etc/bash_complettion -> src/etc/... to avoid copy error" #113579
* lint/ctypes: fix () return type checks #113457
* Rename and allow cast_ref_to_mut lint #113422
* Ignore flaky clippy tests. #113621

r? cuviper
Diffstat (limited to 'compiler/rustc_mir_transform/src/inline.rs')
-rw-r--r--compiler/rustc_mir_transform/src/inline.rs15
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 240beabfc1a..b6578cb259a 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -440,6 +440,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());
@@ -847,7 +851,16 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> {
         if let ProjectionElem::Field(f, ty) = elem {
             let parent_ty = place_ref.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::bind(&ty));
+                let f_ty = this.instance.subst_mir(this.tcx, ty::EarlyBinder::bind(&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;