Skip to content

Commit 3bd5226

Browse files
committed
Use different size on 32bit
1 parent 0c52c3e commit 3bd5226

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/test/ui/consts/issue-66342.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
// Checks that the compiler does not actually try to allocate 4 TB during compilation and OOM crash.
44

5-
fn foo() -> [u8; 4 * 1024 * 1024 * 1024 * 1024] {
5+
#[cfg(target_pointer_width = "64")]
6+
const SIZE: usize = 4 * 1024 * 1024 * 1024 * 1024;
7+
#[cfg(target_pointer_width = "32")]
8+
const SIZE: usize = 2 * 1024 * 1024 * 1024;
9+
10+
fn foo() -> [u8; SIZE] {
611
unimplemented!()
712
}
813

src/test/ui/consts/issue-66397.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
// Checks that the compiler does not actually try to allocate 4 TB during compilation and OOM crash.
44

5+
#[cfg(target_pointer_width = "64")]
6+
const SIZE: usize = 4 * 1024 * 1024 * 1024 * 1024;
7+
#[cfg(target_pointer_width = "32")]
8+
const SIZE: usize = 2 * 1024 * 1024 * 1024;
9+
510
fn main() {
6-
[0; 4 * 1024 * 1024 * 1024 * 1024];
11+
[0; SIZE];
712
}

0 commit comments

Comments
 (0)