storage_live: avoid computing the layout unless necessary

This commit is contained in:
Ralf Jung 2023-08-07 08:18:50 +02:00
parent f87e91de7d
commit 6d1ce9bd13
3 changed files with 69 additions and 18 deletions

View file

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

View file

@ -1,8 +1,8 @@
error: post-monomorphization error: values of the type `[u8; 2305843011361177600]` are too big for the current architecture
--> $DIR/type-too-large.rs:LL:CC
|
LL | let _fat: [u8; (1 << 61) + (1 << 31)];
| ^^^^ values of the type `[u8; 2305843011361177600]` are too big for the current architecture
LL | _fat = [0; (1u64 << 61) as usize + (1u64 << 31) as usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843011361177600]` are too big for the current architecture
|
= note: inside `main` at $DIR/type-too-large.rs:LL:CC