Skip to content

Commit 9263cbb

Browse files
committed
VariantSizeDifferences: bail on SizeOverflow
1 parent 3dbade6 commit 9263cbb

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/librustc_lint/types.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -998,10 +998,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VariantSizeDifferences {
998998
let ty = cx.tcx.erase_regions(&t);
999999
let layout = match cx.layout_of(ty) {
10001000
Ok(layout) => layout,
1001-
Err(ty::layout::LayoutError::Unknown(_)) => return,
1002-
Err(err @ ty::layout::LayoutError::SizeOverflow(_)) => {
1003-
bug!("failed to get layout for `{}`: {}", t, err);
1004-
}
1001+
Err(ty::layout::LayoutError::Unknown(_))
1002+
| Err(ty::layout::LayoutError::SizeOverflow(_)) => return,
10051003
};
10061004
let (variants, tag) = match layout.variants {
10071005
layout::Variants::Multiple {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// build-fail
2+
3+
fn main() {
4+
Bug::V([0; !0]); //~ ERROR is too big for the current
5+
}
6+
7+
enum Bug {
8+
V([u8; !0]),
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: the type `[u8; 18446744073709551615]` is too big for the current architecture
2+
--> $DIR/issue-69485-var-size-diffs-too-large.rs:4:12
3+
|
4+
LL | Bug::V([0; !0]);
5+
| ^^^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)