]> git.lizzy.rs Git - rust.git/commitdiff
Make the tests green as they should on 32-bit architectures
authorAriel Ben-Yehuda <ariel.byd@gmail.com>
Fri, 17 Oct 2014 09:37:27 +0000 (12:37 +0300)
committerAriel Ben-Yehuda <ariel.byd@gmail.com>
Fri, 17 Oct 2014 09:37:27 +0000 (12:37 +0300)
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
src/test/compile-fail/issue-17913.rs

index badaa4b922fce4a055be81c34378b44229cfadac..b23d0716e6ddbb12a2786f6985b474f95819f385 100644 (file)
@@ -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)];
 }
index 7baab03c1190ab43db9d5c239910cdb73f9da14f..037674aaa07bc795cb6e1c3efc2d13e4b14efc06 100644 (file)
 
 // 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]);
+}