From 2ce6154b32c50b3588e0c58b6f106647a8831de8 Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Sat, 30 Aug 2025 10:38:23 +0200 Subject: compiler: Include span of too huge array with `-Cdebuginfo=2` We have a few ui tests to ensure we emit an error if we encounter too big arrays. Before this fix, compiling the tests with `-Cdebuginfo=2` would not include the spans of the instantiation sites, because the error is then emitted from a different code path that does not include the span. Propagate the span to the error also in the debuginfo case, so the tests passes regardless of debuginfo level. --- tests/ui/limits/huge-array-simple-64.full-debuginfo.stderr | 8 ++++++++ tests/ui/limits/huge-array-simple-64.no-debuginfo.stderr | 8 ++++++++ tests/ui/limits/huge-array-simple-64.rs | 5 +++++ tests/ui/limits/huge-array-simple-64.stderr | 8 -------- tests/ui/limits/huge-array.full-debuginfo.stderr | 8 ++++++++ tests/ui/limits/huge-array.no-debuginfo.stderr | 8 ++++++++ tests/ui/limits/huge-array.rs | 5 +++++ tests/ui/limits/huge-array.stderr | 8 -------- tests/ui/limits/issue-15919-64.full-debuginfo.stderr | 8 ++++++++ tests/ui/limits/issue-15919-64.no-debuginfo.stderr | 8 ++++++++ tests/ui/limits/issue-15919-64.rs | 5 +++++ tests/ui/limits/issue-15919-64.stderr | 8 -------- 12 files changed, 63 insertions(+), 24 deletions(-) create mode 100644 tests/ui/limits/huge-array-simple-64.full-debuginfo.stderr create mode 100644 tests/ui/limits/huge-array-simple-64.no-debuginfo.stderr delete mode 100644 tests/ui/limits/huge-array-simple-64.stderr create mode 100644 tests/ui/limits/huge-array.full-debuginfo.stderr create mode 100644 tests/ui/limits/huge-array.no-debuginfo.stderr delete mode 100644 tests/ui/limits/huge-array.stderr create mode 100644 tests/ui/limits/issue-15919-64.full-debuginfo.stderr create mode 100644 tests/ui/limits/issue-15919-64.no-debuginfo.stderr delete mode 100644 tests/ui/limits/issue-15919-64.stderr (limited to 'tests') diff --git a/tests/ui/limits/huge-array-simple-64.full-debuginfo.stderr b/tests/ui/limits/huge-array-simple-64.full-debuginfo.stderr new file mode 100644 index 00000000000..8ce93ab1884 --- /dev/null +++ b/tests/ui/limits/huge-array-simple-64.full-debuginfo.stderr @@ -0,0 +1,8 @@ +error: values of the type `[u8; 2305843011361177600]` are too big for the target architecture + --> $DIR/huge-array-simple-64.rs:12:9 + | +LL | let _fat: [u8; (1<<61)+(1<<31)] = + | ^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/limits/huge-array-simple-64.no-debuginfo.stderr b/tests/ui/limits/huge-array-simple-64.no-debuginfo.stderr new file mode 100644 index 00000000000..8ce93ab1884 --- /dev/null +++ b/tests/ui/limits/huge-array-simple-64.no-debuginfo.stderr @@ -0,0 +1,8 @@ +error: values of the type `[u8; 2305843011361177600]` are too big for the target architecture + --> $DIR/huge-array-simple-64.rs:12:9 + | +LL | let _fat: [u8; (1<<61)+(1<<31)] = + | ^^^^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/limits/huge-array-simple-64.rs b/tests/ui/limits/huge-array-simple-64.rs index d2838e0d41e..0c000940062 100644 --- a/tests/ui/limits/huge-array-simple-64.rs +++ b/tests/ui/limits/huge-array-simple-64.rs @@ -1,3 +1,8 @@ +// FIXME(#61117): Remove revisions once x86_64-gnu-debug CI job sets rust.debuginfo-level-tests=2 +// NOTE: The .stderr for both revisions shall be identical. +//@ revisions: no-debuginfo full-debuginfo +//@[no-debuginfo] compile-flags: -Cdebuginfo=0 +//@[full-debuginfo] compile-flags: -Cdebuginfo=2 //@ build-fail //@ ignore-32bit diff --git a/tests/ui/limits/huge-array-simple-64.stderr b/tests/ui/limits/huge-array-simple-64.stderr deleted file mode 100644 index 46df288d4f7..00000000000 --- a/tests/ui/limits/huge-array-simple-64.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: values of the type `[u8; 2305843011361177600]` are too big for the target architecture - --> $DIR/huge-array-simple-64.rs:7:9 - | -LL | let _fat: [u8; (1<<61)+(1<<31)] = - | ^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/limits/huge-array.full-debuginfo.stderr b/tests/ui/limits/huge-array.full-debuginfo.stderr new file mode 100644 index 00000000000..0a9c8c67ce9 --- /dev/null +++ b/tests/ui/limits/huge-array.full-debuginfo.stderr @@ -0,0 +1,8 @@ +error: values of the type `[[u8; 1518599999]; 1518600000]` are too big for the target architecture + --> $DIR/huge-array.rs:9:9 + | +LL | let s: [T; 1518600000] = [t; 1518600000]; + | ^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/limits/huge-array.no-debuginfo.stderr b/tests/ui/limits/huge-array.no-debuginfo.stderr new file mode 100644 index 00000000000..0a9c8c67ce9 --- /dev/null +++ b/tests/ui/limits/huge-array.no-debuginfo.stderr @@ -0,0 +1,8 @@ +error: values of the type `[[u8; 1518599999]; 1518600000]` are too big for the target architecture + --> $DIR/huge-array.rs:9:9 + | +LL | let s: [T; 1518600000] = [t; 1518600000]; + | ^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/limits/huge-array.rs b/tests/ui/limits/huge-array.rs index 97cfd1ff8fb..0cf59027694 100644 --- a/tests/ui/limits/huge-array.rs +++ b/tests/ui/limits/huge-array.rs @@ -1,3 +1,8 @@ +// FIXME(#61117): Remove revisions once x86_64-gnu-debug CI job sets rust.debuginfo-level-tests=2 +// NOTE: The .stderr for both revisions shall be identical. +//@ revisions: no-debuginfo full-debuginfo +//@[no-debuginfo] compile-flags: -Cdebuginfo=0 +//@[full-debuginfo] compile-flags: -Cdebuginfo=2 //@ build-fail fn generic(t: T) { diff --git a/tests/ui/limits/huge-array.stderr b/tests/ui/limits/huge-array.stderr deleted file mode 100644 index ce0c0d650c2..00000000000 --- a/tests/ui/limits/huge-array.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: values of the type `[[u8; 1518599999]; 1518600000]` are too big for the target architecture - --> $DIR/huge-array.rs:4:9 - | -LL | let s: [T; 1518600000] = [t; 1518600000]; - | ^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/limits/issue-15919-64.full-debuginfo.stderr b/tests/ui/limits/issue-15919-64.full-debuginfo.stderr new file mode 100644 index 00000000000..54434675d25 --- /dev/null +++ b/tests/ui/limits/issue-15919-64.full-debuginfo.stderr @@ -0,0 +1,8 @@ +error: values of the type `[usize; usize::MAX]` are too big for the target architecture + --> $DIR/issue-15919-64.rs:10:9 + | +LL | let x = [0usize; 0xffff_ffff_ffff_ffff]; + | ^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/limits/issue-15919-64.no-debuginfo.stderr b/tests/ui/limits/issue-15919-64.no-debuginfo.stderr new file mode 100644 index 00000000000..54434675d25 --- /dev/null +++ b/tests/ui/limits/issue-15919-64.no-debuginfo.stderr @@ -0,0 +1,8 @@ +error: values of the type `[usize; usize::MAX]` are too big for the target architecture + --> $DIR/issue-15919-64.rs:10:9 + | +LL | let x = [0usize; 0xffff_ffff_ffff_ffff]; + | ^ + +error: aborting due to 1 previous error + diff --git a/tests/ui/limits/issue-15919-64.rs b/tests/ui/limits/issue-15919-64.rs index 7e6200882a9..c1eee1d95ba 100644 --- a/tests/ui/limits/issue-15919-64.rs +++ b/tests/ui/limits/issue-15919-64.rs @@ -1,3 +1,8 @@ +// FIXME(#61117): Remove revisions once x86_64-gnu-debug CI job sets rust.debuginfo-level-tests=2 +// NOTE: The .stderr for both revisions shall be identical. +//@ revisions: no-debuginfo full-debuginfo +//@[no-debuginfo] compile-flags: -Cdebuginfo=0 +//@[full-debuginfo] compile-flags: -Cdebuginfo=2 //@ build-fail //@ ignore-32bit diff --git a/tests/ui/limits/issue-15919-64.stderr b/tests/ui/limits/issue-15919-64.stderr deleted file mode 100644 index cd443f2065b..00000000000 --- a/tests/ui/limits/issue-15919-64.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: values of the type `[usize; usize::MAX]` are too big for the target architecture - --> $DIR/issue-15919-64.rs:5:9 - | -LL | let x = [0usize; 0xffff_ffff_ffff_ffff]; - | ^ - -error: aborting due to 1 previous error - -- cgit 1.4.1-3-g733a5