about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-29 05:00:11 +0000
committerbors <bors@rust-lang.org>2024-06-29 05:00:11 +0000
commitd38cd229b75a7a608e4971c46d1fb5a99343e430 (patch)
tree91e4bf6290fedd62f9ca875b1f7f2bea61e480a5 /compiler/rustc_mir_transform/src
parent9ed2ab3790ff41bf741dd690befd6a1c1e2b23ca (diff)
parentf37272d780d70e79937f8d5c96cc0f9811a98c47 (diff)
downloadrust-d38cd229b75a7a608e4971c46d1fb5a99343e430.tar.gz
rust-d38cd229b75a7a608e4971c46d1fb5a99343e430.zip
Auto merge of #127096 - matthiaskrgr:rollup-kh7e0rh, r=matthiaskrgr
Rollup of 11 pull requests

Successful merges:

 - #123714 (Add test for fn pointer duplication.)
 - #124091 (Update AST validation module docs)
 - #127015 (Switch back `non_local_definitions` lint to allow-by-default)
 - #127016 (docs: check if the disambiguator matches its suffix)
 - #127029 (Fix Markdown tables in platform-support.md)
 - #127032 (Enable const casting for `f16` and `f128`)
 - #127055 (Mark Hasher::finish as #[must_use])
 - #127068 (Stall computing instance for drop shim until it has no unsubstituted const params)
 - #127070 (add () to the marker_impls macro for ConstParamTy)
 - #127071 (Remove (deprecated & unstable) {to,from}_bits pointer methods)
 - #127078 (Enable full tools and profiler for LoongArch Linux targets)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/inline.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index 0a5fc697d03..07482d0571a 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -11,7 +11,7 @@ use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}
 use rustc_middle::mir::visit::*;
 use rustc_middle::mir::*;
 use rustc_middle::ty::TypeVisitableExt;
-use rustc_middle::ty::{self, Instance, InstanceKind, ParamEnv, Ty, TyCtxt};
+use rustc_middle::ty::{self, Instance, InstanceKind, ParamEnv, Ty, TyCtxt, TypeFlags};
 use rustc_session::config::{DebugInfo, OptLevel};
 use rustc_span::source_map::Spanned;
 use rustc_span::sym;
@@ -306,6 +306,16 @@ impl<'tcx> Inliner<'tcx> {
             InstanceKind::Intrinsic(_) | InstanceKind::Virtual(..) => {
                 return Err("instance without MIR (intrinsic / virtual)");
             }
+
+            // FIXME(#127030): `ConstParamHasTy` has bad interactions with
+            // the drop shim builder, which does not evaluate predicates in
+            // the correct param-env for types being dropped. Stall resolving
+            // the MIR for this instance until all of its const params are
+            // substituted.
+            InstanceKind::DropGlue(_, Some(ty)) if ty.has_type_flags(TypeFlags::HAS_CT_PARAM) => {
+                return Err("still needs substitution");
+            }
+
             // This cannot result in an immediate cycle since the callee MIR is a shim, which does
             // not get any optimizations run on it. Any subsequent inlining may cause cycles, but we
             // do not need to catch this here, we can wait until the inliner decides to continue