@@ -351,15 +351,12 @@ impl<'ll, 'tcx> FnAbiLlvmExt<'ll, 'tcx> for FnAbi<'tcx, Ty<'tcx>> {
351
351
// guarnateeing that we generate ABI-compatible LLVM IR. Things get tricky for
352
352
// aggregates...
353
353
if matches ! ( arg. layout. abi, abi:: Abi :: Aggregate { .. } ) {
354
- // This is the most critical case for ABI compatibility, since
355
- // `immediate_llvm_type` will use `layout.fields` to turn this Rust type
356
- // into an LLVM type. ABI-compatible Rust types can have different `fields`,
357
- // so we need to be very sure that LLVM wil treat those different types in
358
- // an ABI-compatible way. Mostly we do this by disallowing
359
- // `PassMode::Direct` for aggregates, but we actually do use that mode on
360
- // wasm. wasm doesn't have aggregate types so we are fairly sure that LLVM
361
- // will treat `{ i32, i32, i32 }` and `{ { i32, i32, i32 } }` the same way
362
- // for ABI purposes.
354
+ // This really shouldn't happen, since `immediate_llvm_type` will use
355
+ // `layout.fields` to turn this Rust type into an LLVM type. This means all
356
+ // sorts of Rust type details leak into the ABI. However wasm sadly *does*
357
+ // currently use this mode so we have to allow it -- but we absolutely
358
+ // shouldn't let any more targets do that.
359
+ // (Also see <https://github.com/rust-lang/rust/issues/115666>.)
363
360
assert ! (
364
361
matches!( & * cx. tcx. sess. target. arch, "wasm32" | "wasm64" ) ,
365
362
"`PassMode::Direct` for aggregates only allowed on wasm targets\n Problematic type: {:#?}" ,
0 commit comments