From 3ce5a9539fc7c20cf6a228bfc7d7fde03b9c6b93 Mon Sep 17 00:00:00 2001 From: Ariel Ben-Yehuda Date: Fri, 17 Oct 2014 12:37:27 +0300 Subject: [PATCH] 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. --- src/test/compile-fail/huge-array-simple.rs | 2 +- src/test/compile-fail/issue-17913.rs | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/test/compile-fail/huge-array-simple.rs b/src/test/compile-fail/huge-array-simple.rs index badaa4b922f..b23d0716e6d 100644 --- a/src/test/compile-fail/huge-array-simple.rs +++ b/src/test/compile-fail/huge-array-simple.rs @@ -11,5 +11,5 @@ // error-pattern: too big for the current fn main() { - let fat : [u8, ..1<<61] = [0, ..1<<61]; + let fat : [u8, ..(1<<61)+(1<<31)] = [0, ..(1<<61)+(1<<31)]; } diff --git a/src/test/compile-fail/issue-17913.rs b/src/test/compile-fail/issue-17913.rs index 7baab03c119..037674aaa07 100644 --- a/src/test/compile-fail/issue-17913.rs +++ b/src/test/compile-fail/issue-17913.rs @@ -10,8 +10,16 @@ // error-pattern: too big for the current architecture +#[cfg(target_word_size = "64")] fn main() { let n = 0u; let a = box [&n,..0xF000000000000000u]; println!("{}", a[0xFFFFFFu]); } + +#[cfg(target_word_size = "32")] +fn main() { + let n = 0u; + let a = box [&n,..0xFFFFFFFFu]; + println!("{}", a[0xFFFFFFu]); +}