]> git.lizzy.rs Git - rust.git/commitdiff
rustup for FieldsShape::Primitive
authorRalf Jung <post@ralfj.de>
Fri, 17 Apr 2020 12:19:26 +0000 (14:19 +0200)
committerRalf Jung <post@ralfj.de>
Fri, 17 Apr 2020 12:19:26 +0000 (14:19 +0200)
rust-version
src/helpers.rs

index 937073ef4fcc3166ebbde27ba2acbf31ace8843e..e9b00f649776853dcdd29c232a9fc1ed72bb4238 100644 (file)
@@ -1 +1 @@
-df768c5c8fcb361c4dc94b4c776d6a78c12862e1
+b2c1a606feb1fbdb0ac0acba76f881ef172ed474
index 9f46a0c1ce2d9e3d8a49c5db4639590e23f36985..40a33f09a83c4f5d9bbee1ee326bd0641de0bdf6 100644 (file)
@@ -1,5 +1,6 @@
 use std::convert::TryFrom;
 use std::mem;
+use std::num::NonZeroUsize;
 
 use log::trace;
 
@@ -333,17 +334,15 @@ fn visit_aggregate(
                         places.sort_by_key(|place| place.ptr.assert_ptr().offset);
                         self.walk_aggregate(place, places.into_iter().map(Ok))
                     }
-                    FieldsShape::Union { .. } => {
+                    FieldsShape::Union { .. } | FieldsShape::Primitive => {
                         // Uh, what?
-                        bug!("a union is not an aggregate we should ever visit")
+                        bug!("unions/primitives are not aggregates we should ever visit")
                     }
                 }
             }
 
             // We have to do *something* for unions.
-            fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>, fields: usize) -> InterpResult<'tcx> {
-                assert!(fields > 0); // we should never reach "pseudo-unions" with 0 fields, like primitives
-
+            fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>, _fields: NonZeroUsize) -> InterpResult<'tcx> {
                 // With unions, we fall back to whatever the type says, to hopefully be consistent
                 // with LLVM IR.
                 // FIXME: are we consistent, and is this really the behavior we want?