Skip to content

Commit 216e686

Browse files
committed
Auto merge of #1344 - RalfJung:rustup, r=RalfJung
rustup for FieldsShape::Primitive
2 parents 562d602 + 6ad0187 commit 216e686

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
df768c5c8fcb361c4dc94b4c776d6a78c12862e1
1+
b2c1a606feb1fbdb0ac0acba76f881ef172ed474

src/helpers.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::convert::TryFrom;
22
use std::mem;
3+
use std::num::NonZeroUsize;
34

45
use log::trace;
56

@@ -333,17 +334,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
333334
places.sort_by_key(|place| place.ptr.assert_ptr().offset);
334335
self.walk_aggregate(place, places.into_iter().map(Ok))
335336
}
336-
FieldsShape::Union { .. } => {
337+
FieldsShape::Union { .. } | FieldsShape::Primitive => {
337338
// Uh, what?
338-
bug!("a union is not an aggregate we should ever visit")
339+
bug!("unions/primitives are not aggregates we should ever visit")
339340
}
340341
}
341342
}
342343

343344
// We have to do *something* for unions.
344-
fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>, fields: usize) -> InterpResult<'tcx> {
345-
assert!(fields > 0); // we should never reach "pseudo-unions" with 0 fields, like primitives
346-
345+
fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>, _fields: NonZeroUsize) -> InterpResult<'tcx> {
347346
// With unions, we fall back to whatever the type says, to hopefully be consistent
348347
// with LLVM IR.
349348
// FIXME: are we consistent, and is this really the behavior we want?

0 commit comments

Comments
 (0)