]> git.lizzy.rs Git - rust.git/commitdiff
make sure we are checking the size of the right thing
authorRalf Jung <post@ralfj.de>
Mon, 23 Mar 2020 10:03:39 +0000 (11:03 +0100)
committerRalf Jung <post@ralfj.de>
Mon, 23 Mar 2020 10:03:39 +0000 (11:03 +0100)
src/librustc/mir/interpret/error.rs

index 010b73db9ac20df8a4c25ef2d90a88a1a50ef9d7..bd7d2c57509b3a5f9013114dc43d49d0213db8a6 100644 (file)
@@ -578,7 +578,7 @@ impl InterpError<'_> {
     pub fn allocates(&self) -> bool {
         match self {
             // Zero-sized boxes do not allocate.
-            InterpError::MachineStop(b) => mem::size_of_val(&**b) > 0,
+            InterpError::MachineStop(b) => mem::size_of_val::<dyn MachineStopType>(&**b) > 0,
             InterpError::Unsupported(UnsupportedOpInfo::Unsupported(_))
             | InterpError::UndefinedBehavior(UndefinedBehaviorInfo::ValidationFailure(_))
             | InterpError::UndefinedBehavior(UndefinedBehaviorInfo::Ub(_))