diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-08-25 22:19:38 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2022-08-26 11:12:36 +1000 |
| commit | f974617bdafa2e5205c1e852fe3ce61f29e2c026 (patch) | |
| tree | f24cb767d9601190bb23aeedc065b8e21871cac9 /compiler/rustc_const_eval/src | |
| parent | b853e8a6194637751bffbcfdd5bb51c7bfecdff5 (diff) | |
| download | rust-f974617bdafa2e5205c1e852fe3ce61f29e2c026.tar.gz rust-f974617bdafa2e5205c1e852fe3ce61f29e2c026.zip | |
Move `ArgAbi::pad_i32` into `PassMode::Cast`.
Because it's only needed for that variant. This shrinks the types and clarifies the logic.
Diffstat (limited to 'compiler/rustc_const_eval/src')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/terminator.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index 2fcdf6ded98..35b1fefd286 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -215,8 +215,6 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { _ => false, } }; - // Padding must be fully equal. - let pad_compat = || caller_abi.pad_i32 == callee_abi.pad_i32; // When comparing the PassMode, we have to be smart about comparing the attributes. let arg_attr_compat = |a1: &ArgAttributes, a2: &ArgAttributes| { // There's only one regular attribute that matters for the call ABI: InReg. @@ -239,7 +237,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { (PassMode::Pair(a1, b1), PassMode::Pair(a2, b2)) => { arg_attr_compat(a1, a2) && arg_attr_compat(b1, b2) } - (PassMode::Cast(c1), PassMode::Cast(c2)) => c1 == c2, + (PassMode::Cast(c1, pad1), PassMode::Cast(c2, pad2)) => c1 == c2 && pad1 == pad2, ( PassMode::Indirect { attrs: a1, extra_attrs: None, on_stack: s1 }, PassMode::Indirect { attrs: a2, extra_attrs: None, on_stack: s2 }, @@ -251,7 +249,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { _ => false, }; - if layout_compat() && pad_compat() && mode_compat() { + if layout_compat() && mode_compat() { return true; } trace!( |
