Skip to content

Commit

Permalink
Stop SRoA'ing DynMetadata in MIR
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmcm committed May 24, 2024
1 parent 213ad10 commit 1caff8e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_mir_transform/src/sroa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1caff8e

Please sign in to comment.