rollup merge of #18728: thestinger/int
This fixes the gap in the language definition causing #18726 by defining a clear bound on the maximum size for libraries to enforce. Closes #18069
This commit is contained in:
commit
fee71bd476
6 changed files with 58 additions and 19 deletions
|
|
@ -12,6 +12,12 @@
|
|||
|
||||
// FIXME: work properly with higher limits
|
||||
|
||||
#[cfg(target_word_size = "32")]
|
||||
fn main() {
|
||||
let big: Option<[u32, ..(1<<29)-1]> = None;
|
||||
}
|
||||
|
||||
#[cfg(target_word_size = "64")]
|
||||
fn main() {
|
||||
let big: Option<[u32, ..(1<<45)-1]> = None;
|
||||
}
|
||||
|
|
|
|||
21
src/test/run-pass/huge-largest-array.rs
Normal file
21
src/test/run-pass/huge-largest-array.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use std::mem::size_of;
|
||||
|
||||
#[cfg(target_word_size = "32")]
|
||||
pub fn main() {
|
||||
assert_eq!(size_of::<[u8, ..(1 << 31) - 1]>(), (1 << 31) - 1);
|
||||
}
|
||||
|
||||
#[cfg(target_word_size = "64")]
|
||||
pub fn main() {
|
||||
assert_eq!(size_of::<[u8, ..(1 << 47) - 1]>(), (1 << 47) - 1);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue