about summary refs log tree commit diff
path: root/compiler/rustc_target/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-03-17 12:10:43 +0100
committerRalf Jung <post@ralfj.de>2025-03-25 08:22:35 +0100
commitc961d123d2df8d9fec6d997a6725b88eabe8d5de (patch)
tree9b20dd43ddd5c6553d62d8f59c04afc404d54caa /compiler/rustc_target/src
parentbe73c1f4617c97bce81b2694a767353300a75072 (diff)
downloadrust-c961d123d2df8d9fec6d997a6725b88eabe8d5de.tar.gz
rust-c961d123d2df8d9fec6d997a6725b88eabe8d5de.zip
add FCW to warn about wasm ABI transition
Diffstat (limited to 'compiler/rustc_target/src')
-rw-r--r--compiler/rustc_target/src/callconv/wasm.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_target/src/callconv/wasm.rs b/compiler/rustc_target/src/callconv/wasm.rs
index 364a6551131..881168c98c3 100644
--- a/compiler/rustc_target/src/callconv/wasm.rs
+++ b/compiler/rustc_target/src/callconv/wasm.rs
@@ -10,6 +10,9 @@ where
     if val.layout.is_aggregate() {
         if let Some(unit) = val.layout.homogeneous_aggregate(cx).ok().and_then(|ha| ha.unit()) {
             let size = val.layout.size;
+            // This size check also catches over-aligned scalars as `size` will be rounded up to a
+            // multiple of the alignment, and the default alignment of all scalar types on wasm
+            // equals their size.
             if unit.size == size {
                 val.cast_to(unit);
                 return true;