Auto merge of #66250 - oli-obk:no_fields_in_empty_unions, r=eddyb

Undo an assert causing an ICE until we fix the underlying problem

r? @eddyb

fixes #65462
This commit is contained in:
bors 2019-11-11 02:52:49 +00:00
commit 1062b698c1
2 changed files with 16 additions and 5 deletions

View File

@ -694,11 +694,7 @@ pub fn count(&self) -> usize {
pub fn offset(&self, i: usize) -> Size {
match *self {
FieldPlacement::Union(count) => {
assert!(i < count,
"Tried to access field {} of union with {} fields", i, count);
Size::ZERO
},
FieldPlacement::Union(_) => Size::ZERO,
FieldPlacement::Array { stride, count } => {
let i = i as u64;
assert!(i < count);

View File

@ -0,0 +1,15 @@
// build-pass
enum Empty {}
enum Enum {
Empty( Empty )
}
fn foobar() -> Option< Enum > {
let value: Option< Empty > = None;
Some( Enum::Empty( value? ) )
}
fn main() {
foobar();
}