mir-interpret now treats unions as non-immediate, even if they have scalar layout, allowing partially initializing them
This commit is contained in:
parent
d32ce37a17
commit
09b291f0b2
6 changed files with 115 additions and 47 deletions
|
@ -15,7 +15,7 @@ use rustc_middle::ty::layout::LayoutOf;
|
|||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_middle::ty::{self, subst::Subst, TyCtxt};
|
||||
use rustc_span::source_map::Span;
|
||||
use rustc_target::abi::Abi;
|
||||
use rustc_target::abi::{self, Abi};
|
||||
use std::borrow::Cow;
|
||||
use std::convert::TryInto;
|
||||
|
||||
|
@ -119,7 +119,7 @@ pub(super) fn op_to_const<'tcx>(
|
|||
// the usual cases of extracting e.g. a `usize`, without there being a real use case for the
|
||||
// `Undef` situation.
|
||||
let try_as_immediate = match op.layout.abi {
|
||||
Abi::Scalar(..) => true,
|
||||
Abi::Scalar(abi::Scalar::Initialized { .. }) => true,
|
||||
Abi::ScalarPair(..) => match op.layout.ty.kind() {
|
||||
ty::Ref(_, inner, _) => match *inner.kind() {
|
||||
ty::Slice(elem) => elem == ecx.tcx.types.u8,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue