mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-15 20:45:45 +03:00
Rollup merge of #69881 - Centril:fix-69485, r=oli-obk
VariantSizeDifferences: bail on SizeOverflow Fixes #69485. r? @oli-obk
This commit is contained in:
@@ -1032,10 +1032,8 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, it: &hir::Item<'_>) {
|
||||
let ty = cx.tcx.erase_regions(&t);
|
||||
let layout = match cx.layout_of(ty) {
|
||||
Ok(layout) => layout,
|
||||
Err(ty::layout::LayoutError::Unknown(_)) => return,
|
||||
Err(err @ ty::layout::LayoutError::SizeOverflow(_)) => {
|
||||
bug!("failed to get layout for `{}`: {}", t, err);
|
||||
}
|
||||
Err(ty::layout::LayoutError::Unknown(_))
|
||||
| Err(ty::layout::LayoutError::SizeOverflow(_)) => return,
|
||||
};
|
||||
let (variants, tag) = match layout.variants {
|
||||
layout::Variants::Multiple {
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// build-fail
|
||||
// only-x86_64
|
||||
|
||||
fn main() {
|
||||
Bug::V([0; !0]); //~ ERROR is too big for the current
|
||||
}
|
||||
|
||||
enum Bug {
|
||||
V([u8; !0]),
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
error: the type `[u8; 18446744073709551615]` is too big for the current architecture
|
||||
--> $DIR/issue-69485-var-size-diffs-too-large.rs:5:12
|
||||
|
|
||||
LL | Bug::V([0; !0]);
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Reference in New Issue
Block a user