diff options
Diffstat (limited to '')
24 files changed, 342 insertions, 0 deletions
diff --git a/src/test/ui/limits/huge-array-simple-32.rs b/src/test/ui/limits/huge-array-simple-32.rs new file mode 100644 index 000000000..2290e3d5e --- /dev/null +++ b/src/test/ui/limits/huge-array-simple-32.rs @@ -0,0 +1,12 @@ +// ignore-64bit +// build-fail + +// FIXME https://github.com/rust-lang/rust/issues/59774 +// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" +#![allow(arithmetic_overflow)] + +fn main() { + let _fat: [u8; (1<<31)+(1<<15)] = //~ ERROR too big for the current architecture + [0; (1u32<<31) as usize +(1u32<<15) as usize]; +} diff --git a/src/test/ui/limits/huge-array-simple-32.stderr b/src/test/ui/limits/huge-array-simple-32.stderr new file mode 100644 index 000000000..31e120df6 --- /dev/null +++ b/src/test/ui/limits/huge-array-simple-32.stderr @@ -0,0 +1,8 @@ +error: values of the type `[u8; 2147516416]` are too big for the current architecture + --> $DIR/huge-array-simple-32.rs:10:9 + | +LL | let _fat: [u8; (1<<31)+(1<<15)] = + | ^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/limits/huge-array-simple-64.rs b/src/test/ui/limits/huge-array-simple-64.rs new file mode 100644 index 000000000..02c961fc5 --- /dev/null +++ b/src/test/ui/limits/huge-array-simple-64.rs @@ -0,0 +1,12 @@ +// build-fail +// ignore-32bit + +// FIXME https://github.com/rust-lang/rust/issues/59774 +// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" +#![allow(arithmetic_overflow)] + +fn main() { + let _fat: [u8; (1<<61)+(1<<31)] = //~ ERROR too big for the current architecture + [0; (1u64<<61) as usize +(1u64<<31) as usize]; +} diff --git a/src/test/ui/limits/huge-array-simple-64.stderr b/src/test/ui/limits/huge-array-simple-64.stderr new file mode 100644 index 000000000..c5d3fe85d --- /dev/null +++ b/src/test/ui/limits/huge-array-simple-64.stderr @@ -0,0 +1,8 @@ +error: values of the type `[u8; 2305843011361177600]` are too big for the current architecture + --> $DIR/huge-array-simple-64.rs:10:9 + | +LL | let _fat: [u8; (1<<61)+(1<<31)] = + | ^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/limits/huge-array.rs b/src/test/ui/limits/huge-array.rs new file mode 100644 index 000000000..3070801f8 --- /dev/null +++ b/src/test/ui/limits/huge-array.rs @@ -0,0 +1,15 @@ +// FIXME https://github.com/rust-lang/rust/issues/59774 + +// build-fail +// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" + +fn generic<T: Copy>(t: T) { + let s: [T; 1518600000] = [t; 1518600000]; + //~^ ERROR values of the type `[[u8; 1518599999]; 1518600000]` are too big +} + +fn main() { + let x: [u8; 1518599999] = [0; 1518599999]; + generic::<[u8; 1518599999]>(x); +} diff --git a/src/test/ui/limits/huge-array.stderr b/src/test/ui/limits/huge-array.stderr new file mode 100644 index 000000000..817458b73 --- /dev/null +++ b/src/test/ui/limits/huge-array.stderr @@ -0,0 +1,8 @@ +error: values of the type `[[u8; 1518599999]; 1518600000]` are too big for the current architecture + --> $DIR/huge-array.rs:8:9 + | +LL | let s: [T; 1518600000] = [t; 1518600000]; + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/limits/huge-enum.rs b/src/test/ui/limits/huge-enum.rs new file mode 100644 index 000000000..39ea6e11b --- /dev/null +++ b/src/test/ui/limits/huge-enum.rs @@ -0,0 +1,18 @@ +// build-fail +// normalize-stderr-test "std::option::Option<\[u32; \d+\]>" -> "TYPE" +// normalize-stderr-test "\[u32; \d+\]" -> "TYPE" + +// FIXME https://github.com/rust-lang/rust/issues/59774 +// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" + +#[cfg(target_pointer_width = "32")] +type BIG = Option<[u32; (1<<29)-1]>; + +#[cfg(target_pointer_width = "64")] +type BIG = Option<[u32; (1<<45)-1]>; + +fn main() { + let big: BIG = None; + //~^ ERROR are too big for the current architecture +} diff --git a/src/test/ui/limits/huge-enum.stderr b/src/test/ui/limits/huge-enum.stderr new file mode 100644 index 000000000..a1456e1a8 --- /dev/null +++ b/src/test/ui/limits/huge-enum.stderr @@ -0,0 +1,8 @@ +error: values of the type `Option<TYPE>` are too big for the current architecture + --> $DIR/huge-enum.rs:16:9 + | +LL | let big: BIG = None; + | ^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/limits/huge-struct.rs b/src/test/ui/limits/huge-struct.rs new file mode 100644 index 000000000..02f38d860 --- /dev/null +++ b/src/test/ui/limits/huge-struct.rs @@ -0,0 +1,53 @@ +// build-fail +// normalize-stderr-test "S32" -> "SXX" +// normalize-stderr-test "S1M" -> "SXX" +// error-pattern: too big for the current + +// FIXME https://github.com/rust-lang/rust/issues/59774 +// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" + +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; + //~^ ERROR are too big for the current architecture + +} diff --git a/src/test/ui/limits/huge-struct.stderr b/src/test/ui/limits/huge-struct.stderr new file mode 100644 index 000000000..f0ee88e59 --- /dev/null +++ b/src/test/ui/limits/huge-struct.stderr @@ -0,0 +1,8 @@ +error: values of the type `SXX<SXX<SXX<u32>>>` are too big for the current architecture + --> $DIR/huge-struct.rs:50:9 + | +LL | let fat: Option<SXX<SXX<SXX<u32>>>> = None; + | ^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/limits/issue-15919-32.rs b/src/test/ui/limits/issue-15919-32.rs new file mode 100644 index 000000000..3c93f14cc --- /dev/null +++ b/src/test/ui/limits/issue-15919-32.rs @@ -0,0 +1,13 @@ +// ignore-64bit +// build-fail + +// FIXME https://github.com/rust-lang/rust/issues/59774 +// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" + +fn main() { + let x = [0usize; 0xffff_ffff]; //~ ERROR too big +} + +// This and the -64 version of this test need to have different literals, as we can't rely on +// conditional compilation for them while retaining the same spans/lines. diff --git a/src/test/ui/limits/issue-15919-32.stderr b/src/test/ui/limits/issue-15919-32.stderr new file mode 100644 index 000000000..133637f9a --- /dev/null +++ b/src/test/ui/limits/issue-15919-32.stderr @@ -0,0 +1,8 @@ +error: values of the type `[usize; 4294967295]` are too big for the current architecture + --> $DIR/issue-15919-32.rs:9:9 + | +LL | let x = [0usize; 0xffff_ffff]; + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/limits/issue-15919-64.rs b/src/test/ui/limits/issue-15919-64.rs new file mode 100644 index 000000000..3ecbd34ea --- /dev/null +++ b/src/test/ui/limits/issue-15919-64.rs @@ -0,0 +1,13 @@ +// build-fail +// ignore-32bit + +// FIXME https://github.com/rust-lang/rust/issues/59774 +// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" + +fn main() { + let x = [0usize; 0xffff_ffff_ffff_ffff]; //~ ERROR too big +} + +// This and the -32 version of this test need to have different literals, as we can't rely on +// conditional compilation for them while retaining the same spans/lines. diff --git a/src/test/ui/limits/issue-15919-64.stderr b/src/test/ui/limits/issue-15919-64.stderr new file mode 100644 index 000000000..193b82303 --- /dev/null +++ b/src/test/ui/limits/issue-15919-64.stderr @@ -0,0 +1,8 @@ +error: values of the type `[usize; 18446744073709551615]` are too big for the current architecture + --> $DIR/issue-15919-64.rs:9:9 + | +LL | let x = [0usize; 0xffff_ffff_ffff_ffff]; + | ^ + +error: aborting due to previous error + diff --git a/src/test/ui/limits/issue-17913.rs b/src/test/ui/limits/issue-17913.rs new file mode 100644 index 000000000..ca13b9bd6 --- /dev/null +++ b/src/test/ui/limits/issue-17913.rs @@ -0,0 +1,23 @@ +// build-fail +// normalize-stderr-test "\[&usize; \d+\]" -> "[&usize; N]" +// error-pattern: too big for the current architecture + +// FIXME https://github.com/rust-lang/rust/issues/59774 +// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" + +#![feature(box_syntax)] + +#[cfg(target_pointer_width = "64")] +fn main() { + let n = 0_usize; + let a: Box<_> = box [&n; 0xF000000000000000_usize]; + println!("{}", a[0xFFFFFF_usize]); +} + +#[cfg(target_pointer_width = "32")] +fn main() { + let n = 0_usize; + let a: Box<_> = box [&n; 0xFFFFFFFF_usize]; + println!("{}", a[0xFFFFFF_usize]); +} diff --git a/src/test/ui/limits/issue-17913.stderr b/src/test/ui/limits/issue-17913.stderr new file mode 100644 index 000000000..9a6431d44 --- /dev/null +++ b/src/test/ui/limits/issue-17913.stderr @@ -0,0 +1,4 @@ +error: values of the type `[&usize; N]` are too big for the current architecture + +error: aborting due to previous error + diff --git a/src/test/ui/limits/issue-55878.rs b/src/test/ui/limits/issue-55878.rs new file mode 100644 index 000000000..c1c54646d --- /dev/null +++ b/src/test/ui/limits/issue-55878.rs @@ -0,0 +1,8 @@ +// build-fail +// normalize-stderr-64bit "18446744073709551615" -> "SIZE" +// normalize-stderr-32bit "4294967295" -> "SIZE" + +// error-pattern: are too big for the current architecture +fn main() { + println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); +} diff --git a/src/test/ui/limits/issue-55878.stderr b/src/test/ui/limits/issue-55878.stderr new file mode 100644 index 000000000..6c3683d78 --- /dev/null +++ b/src/test/ui/limits/issue-55878.stderr @@ -0,0 +1,37 @@ +error[E0080]: values of the type `[u8; SIZE]` are too big for the current architecture + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + | +LL | intrinsics::size_of::<T>() + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ inside `std::mem::size_of::<[u8; SIZE]>` at $SRC_DIR/core/src/mem/mod.rs:LL:COL + | + ::: $DIR/issue-55878.rs:7:26 + | +LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); + | ---------------------------------------------- inside `main` at $DIR/issue-55878.rs:7:26 + +error: erroneous constant used + --> $DIR/issue-55878.rs:7:26 + | +LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + | + = note: `#[deny(const_err)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0080`. +Future incompatibility report: Future breakage diagnostic: +error: erroneous constant used + --> $DIR/issue-55878.rs:7:26 + | +LL | println!("Size: {}", std::mem::size_of::<[u8; u64::MAX as usize]>()); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + | + = note: `#[deny(const_err)]` on by default + = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! + = note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> + = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) + diff --git a/src/test/ui/limits/issue-56762.rs b/src/test/ui/limits/issue-56762.rs new file mode 100644 index 000000000..fb0a270f1 --- /dev/null +++ b/src/test/ui/limits/issue-56762.rs @@ -0,0 +1,24 @@ +// only-x86_64 + +// FIXME https://github.com/rust-lang/rust/issues/59774 +// normalize-stderr-test "thread.*panicked.*Metadata module not compiled.*\n" -> "" +// normalize-stderr-test "note:.*RUST_BACKTRACE=1.*\n" -> "" +const HUGE_SIZE: usize = !0usize / 8; + + +pub struct TooBigArray { + arr: [u8; HUGE_SIZE], +} + +impl TooBigArray { + pub const fn new() -> Self { + TooBigArray { arr: [0x00; HUGE_SIZE], } + } +} + +static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new(); +//~^ ERROR values of the type `[u8; 2305843009213693951]` are too big +static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE]; +//~^ ERROR values of the type `[u8; 2305843009213693951]` are too big + +fn main() { } diff --git a/src/test/ui/limits/issue-56762.stderr b/src/test/ui/limits/issue-56762.stderr new file mode 100644 index 000000000..e6b9c6762 --- /dev/null +++ b/src/test/ui/limits/issue-56762.stderr @@ -0,0 +1,15 @@ +error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture + --> $DIR/issue-56762.rs:19:1 + | +LL | static MY_TOO_BIG_ARRAY_1: TooBigArray = TooBigArray::new(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0080]: values of the type `[u8; 2305843009213693951]` are too big for the current architecture + --> $DIR/issue-56762.rs:21:1 + | +LL | static MY_TOO_BIG_ARRAY_2: [u8; HUGE_SIZE] = [0x00; HUGE_SIZE]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0080`. diff --git a/src/test/ui/limits/issue-69485-var-size-diffs-too-large.rs b/src/test/ui/limits/issue-69485-var-size-diffs-too-large.rs new file mode 100644 index 000000000..2560ffe16 --- /dev/null +++ b/src/test/ui/limits/issue-69485-var-size-diffs-too-large.rs @@ -0,0 +1,11 @@ +// build-fail +// only-x86_64 +// compile-flags: -Zmir-opt-level=0 + +fn main() { + Bug::V([0; !0]); //~ ERROR are too big for the current +} + +enum Bug { + V([u8; !0]), +} diff --git a/src/test/ui/limits/issue-69485-var-size-diffs-too-large.stderr b/src/test/ui/limits/issue-69485-var-size-diffs-too-large.stderr new file mode 100644 index 000000000..f7923bd47 --- /dev/null +++ b/src/test/ui/limits/issue-69485-var-size-diffs-too-large.stderr @@ -0,0 +1,8 @@ +error: values of the type `[u8; 18446744073709551615]` are too big for the current architecture + --> $DIR/issue-69485-var-size-diffs-too-large.rs:6:5 + | +LL | Bug::V([0; !0]); + | ^^^^^^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/src/test/ui/limits/issue-75158-64.rs b/src/test/ui/limits/issue-75158-64.rs new file mode 100644 index 000000000..06c209c07 --- /dev/null +++ b/src/test/ui/limits/issue-75158-64.rs @@ -0,0 +1,16 @@ +//~ ERROR + +// build-fail +// ignore-32bit + +struct S<T> { + x: [T; !0], +} + +pub fn f() -> usize { + std::mem::size_of::<S<u8>>() +} + +fn main() { + let x = f(); +} diff --git a/src/test/ui/limits/issue-75158-64.stderr b/src/test/ui/limits/issue-75158-64.stderr new file mode 100644 index 000000000..dc11d0561 --- /dev/null +++ b/src/test/ui/limits/issue-75158-64.stderr @@ -0,0 +1,4 @@ +error: values of the type `[u8; 18446744073709551615]` are too big for the current architecture + +error: aborting due to previous error + |