Skip to content

Commit

Permalink
Make the tests green as they should on 32-bit architectures
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
arielb1 committed Oct 17, 2014
1 parent 50db061 commit 3ce5a95
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/test/compile-fail/huge-array-simple.rs
Expand Up @@ -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)];
}
8 changes: 8 additions & 0 deletions src/test/compile-fail/issue-17913.rs
Expand Up @@ -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]);
}

4 comments on commit 3ce5a95

@bors
Copy link
Contributor

@bors bors commented on 3ce5a95 Oct 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pnkfelix
at arielb1@3ce5a95

@bors
Copy link
Contributor

@bors bors commented on 3ce5a95 Oct 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging arielb1/rust/no-size-overflow = 3ce5a95 into auto

@bors
Copy link
Contributor

@bors bors commented on 3ce5a95 Oct 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arielb1/rust/no-size-overflow = 3ce5a95 merged ok, testing candidate = 9c11773e

@bors
Copy link
Contributor

@bors bors commented on 3ce5a95 Oct 18, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.