about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-05-26 13:43:07 +0200
committerGitHub <noreply@github.com>2024-05-26 13:43:07 +0200
commit5fef6c511d8cee3f293464c615a24b4c80c1cb35 (patch)
tree2b05670407fda9a037a5db06c5dbf57d9efdaca5 /compiler/rustc_mir_transform/src
parentc7a17656a0828aa916ea5e90e31b3f84d00f3b97 (diff)
parentd7248d7b71fd756bef62e98b52ee1110f8d3a3c4 (diff)
downloadrust-5fef6c511d8cee3f293464c615a24b4c80c1cb35.tar.gz
rust-5fef6c511d8cee3f293464c615a24b4c80c1cb35.zip
Rollup merge of #125508 - scottmcm:fix-125506, r=Nilstrieb
Stop SRoA'ing `DynMetadata` in MIR

Fixes #125506
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/sroa.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_mir_transform/src/sroa.rs b/compiler/rustc_mir_transform/src/sroa.rs
index cdf3305b560..f19c34cae7a 100644
--- a/compiler/rustc_mir_transform/src/sroa.rs
+++ b/compiler/rustc_mir_transform/src/sroa.rs
@@ -70,6 +70,11 @@ fn escaping_locals<'tcx>(
                 // Exclude #[repr(simd)] types so that they are not de-optimized into an array
                 return true;
             }
+            if Some(def.did()) == tcx.lang_items().dyn_metadata() {
+                // codegen wants to see the `DynMetadata<T>`,
+                // not the inner reference-to-opaque-type.
+                return true;
+            }
             // We already excluded unions and enums, so this ADT must have one variant
             let variant = def.variant(FIRST_VARIANT);
             if variant.fields.len() > 1 {