Skip to content

rustup for FieldsShape::Primitive #1344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
df768c5c8fcb361c4dc94b4c776d6a78c12862e1
b2c1a606feb1fbdb0ac0acba76f881ef172ed474
9 changes: 4 additions & 5 deletions src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::convert::TryFrom;
use std::mem;
use std::num::NonZeroUsize;

use log::trace;

Expand Down Expand Up @@ -333,17 +334,15 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
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?
Expand Down