Skip to content

Commit 79d85fb

Browse files
authored
Rollup merge of rust-lang#69881 - Centril:fix-69485, r=oli-obk
VariantSizeDifferences: bail on SizeOverflow Fixes rust-lang#69485. r? @oli-obk
2 parents 1350be7 + 81099c2 commit 79d85fb

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

src/librustc_lint/types.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1032,10 +1032,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for VariantSizeDifferences {
10321032
let ty = cx.tcx.erase_regions(&t);
10331033
let layout = match cx.layout_of(ty) {
10341034
Ok(layout) => layout,
1035-
Err(ty::layout::LayoutError::Unknown(_)) => return,
1036-
Err(err @ ty::layout::LayoutError::SizeOverflow(_)) => {
1037-
bug!("failed to get layout for `{}`: {}", t, err);
1038-
}
1035+
Err(ty::layout::LayoutError::Unknown(_))
1036+
| Err(ty::layout::LayoutError::SizeOverflow(_)) => return,
10391037
};
10401038
let (variants, tag) = match layout.variants {
10411039
layout::Variants::Multiple {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// build-fail
2+
// only-x86_64
3+
4+
fn main() {
5+
Bug::V([0; !0]); //~ ERROR is too big for the current
6+
}
7+
8+
enum Bug {
9+
V([u8; !0]),
10+
}
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:5:12
3+
|
4+
LL | Bug::V([0; !0]);
5+
| ^^^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)