Skip to content

Commit 39fb820

Browse files
committed
Undo an assert causing an ICE until we fix the problem properly
1 parent 5a50275 commit 39fb820

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/librustc_target/abi/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,7 @@ impl FieldPlacement {
694694

695695
pub fn offset(&self, i: usize) -> Size {
696696
match *self {
697-
FieldPlacement::Union(count) => {
698-
assert!(i < count,
699-
"Tried to access field {} of union with {} fields", i, count);
700-
Size::ZERO
701-
},
697+
FieldPlacement::Union(_) => Size::ZERO,
702698
FieldPlacement::Array { stride, count } => {
703699
let i = i as u64;
704700
assert!(i < count);

src/test/ui/issues/issue-65462.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// build-pass
2+
3+
enum Empty {}
4+
enum Enum {
5+
Empty( Empty )
6+
}
7+
8+
fn foobar() -> Option< Enum > {
9+
let value: Option< Empty > = None;
10+
Some( Enum::Empty( value? ) )
11+
}
12+
13+
fn main() {
14+
foobar();
15+
}

0 commit comments

Comments
 (0)