We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 76fe6a4 commit 373c362Copy full SHA for 373c362
src/librustc_target/abi/mod.rs
@@ -738,7 +738,11 @@ impl FieldPlacement {
738
739
pub fn offset(&self, i: usize) -> Size {
740
match *self {
741
- FieldPlacement::Union(_) => Size::ZERO,
+ FieldPlacement::Union(count) => {
742
+ assert!(i < count,
743
+ "Tried to access field {} of union with {} fields", i, count);
744
+ Size::ZERO
745
+ },
746
FieldPlacement::Array { stride, count } => {
747
let i = i as u64;
748
assert!(i < count);
0 commit comments