Skip to content

Commit 3ce5a95

Browse files
committed
Make the tests green as they should on 32-bit architectures
On 32-bit architectures, the size calculations on two of the tests wrap-around in typeck, which gives the relevant arrays a size of 0, which is (correctly) successfully allocated.
1 parent 50db061 commit 3ce5a95

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/test/compile-fail/huge-array-simple.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
// error-pattern: too big for the current
1212

1313
fn main() {
14-
let fat : [u8, ..1<<61] = [0, ..1<<61];
14+
let fat : [u8, ..(1<<61)+(1<<31)] = [0, ..(1<<61)+(1<<31)];
1515
}

src/test/compile-fail/issue-17913.rs

+8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,16 @@
1010

1111
// error-pattern: too big for the current architecture
1212

13+
#[cfg(target_word_size = "64")]
1314
fn main() {
1415
let n = 0u;
1516
let a = box [&n,..0xF000000000000000u];
1617
println!("{}", a[0xFFFFFFu]);
1718
}
19+
20+
#[cfg(target_word_size = "32")]
21+
fn main() {
22+
let n = 0u;
23+
let a = box [&n,..0xFFFFFFFFu];
24+
println!("{}", a[0xFFFFFFu]);
25+
}

0 commit comments

Comments
 (0)