Skip to content

Commit 3f7164d

Browse files
committed
storage_live: avoid computing the layout unless necessary
1 parent ae92817 commit 3f7164d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/fail/type-too-large.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ignore-32bit
22

33
fn main() {
4-
let _fat: [u8; (1 << 61) + (1 << 31)]; //~ ERROR: post-monomorphization error
5-
_fat = [0; (1u64 << 61) as usize + (1u64 << 31) as usize];
4+
let _fat: [u8; (1 << 61) + (1 << 31)]; // ideally we'd error here, but we avoid computing the layout until absolutely necessary
5+
_fat = [0; (1u64 << 61) as usize + (1u64 << 31) as usize]; //~ ERROR: post-monomorphization error
66
}

tests/fail/type-too-large.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error: post-monomorphization error: values of the type `[u8; 2305843011361177600]` are too big for the current architecture
22
--> $DIR/type-too-large.rs:LL:CC
33
|
4-
LL | let _fat: [u8; (1 << 61) + (1 << 31)];
5-
| ^^^^ values of the type `[u8; 2305843011361177600]` are too big for the current architecture
4+
LL | _fat = [0; (1u64 << 61) as usize + (1u64 << 31) as usize];
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843011361177600]` are too big for the current architecture
66
|
77
= note: inside `main` at $DIR/type-too-large.rs:LL:CC
88

0 commit comments

Comments
 (0)