mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-08 13:02:50 +00:00
add some tests
This commit is contained in:
parent
e053dfad23
commit
1ee345a87b
17
src/test/compile-fail/issue-17913.rs
Normal file
17
src/test/compile-fail/issue-17913.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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.
|
||||
|
||||
// error-pattern: too big for the current ABI
|
||||
|
||||
fn main() {
|
||||
let n = 0u;
|
||||
let a = box [&n,..0xF000000000000000u];
|
||||
println!("{}", a[0xFFFFFFu]);
|
||||
}
|
20
src/test/compile-fail/oversized-array.rs
Normal file
20
src/test/compile-fail/oversized-array.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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.
|
||||
|
||||
// error-pattern: 1518599999
|
||||
|
||||
fn generic<T: Copy>(t: T) {
|
||||
let s: [T, ..1518600000] = [t, ..1518600000];
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x: [u8, ..1518599999] = [0, ..1518599999];
|
||||
generic::<[u8, ..1518599999]>(x);
|
||||
}
|
17
src/test/compile-fail/oversized-discriminant.rs
Normal file
17
src/test/compile-fail/oversized-discriminant.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// 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.
|
||||
|
||||
// error-pattern: Option
|
||||
|
||||
// FIXME: work properly with higher limits
|
||||
|
||||
fn main() {
|
||||
let big: Option<[u32, ..(1<<29)-1]> = None;
|
||||
}
|
54
src/test/compile-fail/oversized-struct.rs
Normal file
54
src/test/compile-fail/oversized-struct.rs
Normal file
@ -0,0 +1,54 @@
|
||||
// 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.
|
||||
|
||||
// error-pattern: are too big for the current ABI
|
||||
|
||||
struct S32<T> {
|
||||
v0: T,
|
||||
v1: T,
|
||||
v2: T,
|
||||
v3: T,
|
||||
v4: T,
|
||||
v5: T,
|
||||
v6: T,
|
||||
v7: T,
|
||||
v8: T,
|
||||
u9: T,
|
||||
v10: T,
|
||||
v11: T,
|
||||
v12: T,
|
||||
v13: T,
|
||||
v14: T,
|
||||
v15: T,
|
||||
v16: T,
|
||||
v17: T,
|
||||
v18: T,
|
||||
v19: T,
|
||||
v20: T,
|
||||
v21: T,
|
||||
v22: T,
|
||||
v23: T,
|
||||
v24: T,
|
||||
u25: T,
|
||||
v26: T,
|
||||
v27: T,
|
||||
v28: T,
|
||||
v29: T,
|
||||
v30: T,
|
||||
v31: T,
|
||||
}
|
||||
|
||||
struct S1k<T> { val: S32<S32<T>> }
|
||||
|
||||
struct S1M<T> { val: S1k<S1k<T>> }
|
||||
|
||||
fn main() {
|
||||
let fat: Option<S1M<S1M<S1M<u32>>>> = None;
|
||||
}
|
15
src/test/compile-fail/simple-oversized-array.rs
Normal file
15
src/test/compile-fail/simple-oversized-array.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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.
|
||||
|
||||
// error-pattern: too big for the current ABI
|
||||
|
||||
fn main() {
|
||||
let fat : [u8, ..1<<61] = [0, ..1<<61];
|
||||
}
|
Loading…
Reference in New Issue
Block a user