Skip to content

Commit 1ee345a

Browse files
committed
add some tests
1 parent e053dfa commit 1ee345a

File tree

5 files changed

+123
-0
lines changed

5 files changed

+123
-0
lines changed

src/test/compile-fail/issue-17913.rs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// error-pattern: too big for the current ABI
12+
13+
fn main() {
14+
let n = 0u;
15+
let a = box [&n,..0xF000000000000000u];
16+
println!("{}", a[0xFFFFFFu]);
17+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// error-pattern: 1518599999
12+
13+
fn generic<T: Copy>(t: T) {
14+
let s: [T, ..1518600000] = [t, ..1518600000];
15+
}
16+
17+
fn main() {
18+
let x: [u8, ..1518599999] = [0, ..1518599999];
19+
generic::<[u8, ..1518599999]>(x);
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// error-pattern: Option
12+
13+
// FIXME: work properly with higher limits
14+
15+
fn main() {
16+
let big: Option<[u32, ..(1<<29)-1]> = None;
17+
}
+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// error-pattern: are too big for the current ABI
12+
13+
struct S32<T> {
14+
v0: T,
15+
v1: T,
16+
v2: T,
17+
v3: T,
18+
v4: T,
19+
v5: T,
20+
v6: T,
21+
v7: T,
22+
v8: T,
23+
u9: T,
24+
v10: T,
25+
v11: T,
26+
v12: T,
27+
v13: T,
28+
v14: T,
29+
v15: T,
30+
v16: T,
31+
v17: T,
32+
v18: T,
33+
v19: T,
34+
v20: T,
35+
v21: T,
36+
v22: T,
37+
v23: T,
38+
v24: T,
39+
u25: T,
40+
v26: T,
41+
v27: T,
42+
v28: T,
43+
v29: T,
44+
v30: T,
45+
v31: T,
46+
}
47+
48+
struct S1k<T> { val: S32<S32<T>> }
49+
50+
struct S1M<T> { val: S1k<S1k<T>> }
51+
52+
fn main() {
53+
let fat: Option<S1M<S1M<S1M<u32>>>> = None;
54+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// error-pattern: too big for the current ABI
12+
13+
fn main() {
14+
let fat : [u8, ..1<<61] = [0, ..1<<61];
15+
}

0 commit comments

Comments
 (0)