about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-07-28 17:06:58 -0400
committerRalf Jung <post@ralfj.de>2022-07-30 21:44:34 -0400
commit5798555812228600a27fa3d3b2c20b422c6d97c7 (patch)
treef9bd31065d76bf994a700fbd1ef94baf1edb63b3 /compiler/rustc_const_eval/src/interpret
parent4d6d601c8a83284d6b23c253a3e2a060fd197316 (diff)
downloadrust-5798555812228600a27fa3d3b2c20b422c6d97c7.tar.gz
rust-5798555812228600a27fa3d3b2c20b422c6d97c7.zip
interpret: only consider 1-ZST when searching for receiver
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
-rw-r--r--compiler/rustc_const_eval/src/interpret/terminator.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs
index d563e35f910..c8557d172ed 100644
--- a/compiler/rustc_const_eval/src/interpret/terminator.rs
+++ b/compiler/rustc_const_eval/src/interpret/terminator.rs
@@ -534,7 +534,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                             let mut non_zst_field = None;
                             for i in 0..receiver.layout.fields.count() {
                                 let field = self.operand_field(&receiver, i)?;
-                                if !field.layout.is_zst() {
+                                let zst =
+                                    field.layout.is_zst() && field.layout.align.abi.bytes() == 1;
+                                if !zst {
                                     assert!(
                                         non_zst_field.is_none(),
                                         "multiple non-ZST fields in dyn receiver type {}",