diff --git a/src/test/compile-fail/issue-17913.rs b/src/test/compile-fail/issue-17913.rs new file mode 100644 index 00000000000..8420ea3f4b3 --- /dev/null +++ b/src/test/compile-fail/issue-17913.rs @@ -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 or the MIT license +// , 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]); +} diff --git a/src/test/compile-fail/oversized-array.rs b/src/test/compile-fail/oversized-array.rs new file mode 100644 index 00000000000..37a5bca424d --- /dev/null +++ b/src/test/compile-fail/oversized-array.rs @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern: 1518599999 + +fn generic(t: T) { + let s: [T, ..1518600000] = [t, ..1518600000]; +} + +fn main() { + let x: [u8, ..1518599999] = [0, ..1518599999]; + generic::<[u8, ..1518599999]>(x); +} diff --git a/src/test/compile-fail/oversized-discriminant.rs b/src/test/compile-fail/oversized-discriminant.rs new file mode 100644 index 00000000000..92f9c41e7ea --- /dev/null +++ b/src/test/compile-fail/oversized-discriminant.rs @@ -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 or the MIT license +// , 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; +} diff --git a/src/test/compile-fail/oversized-struct.rs b/src/test/compile-fail/oversized-struct.rs new file mode 100644 index 00000000000..c1274ba1c01 --- /dev/null +++ b/src/test/compile-fail/oversized-struct.rs @@ -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 or the MIT license +// , 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 { + 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 { val: S32> } + +struct S1M { val: S1k> } + +fn main() { + let fat: Option>>> = None; +} diff --git a/src/test/compile-fail/simple-oversized-array.rs b/src/test/compile-fail/simple-oversized-array.rs new file mode 100644 index 00000000000..3edabc0b5db --- /dev/null +++ b/src/test/compile-fail/simple-oversized-array.rs @@ -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 or the MIT license +// , 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]; +}