rust/tests/ui/simd
Matthias Krüger f012947bf0
Rollup merge of #136503 - estebank:const-panic, r=RalfJung
Tweak output of const panic diagnostic

### Shorten span of panic failures in const context

Previously, we included a redundant prefix on the panic message and a postfix of the location of the panic. The prefix didn't carry any additional information beyond "something failed", and the location of the panic is redundant with the diagnostic's span, which gets printed out even if its code is not shown.

```
error[E0080]: evaluation of constant value failed
--> $DIR/assert-type-intrinsics.rs:11:9
   |
LL |         MaybeUninit::<!>::uninit().assume_init();
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ panic: aborted execution: attempted to instantiate uninhabited type `!`
```

```
error[E0080]: evaluation of `Fail::<i32>::C` failed
--> $DIR/collect-in-dead-closure.rs:9:19
   |
LL |     const C: () = panic!();
   |                   ^^^^^^^^ explicit panic
   |
   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
```
```
error[E0080]: evaluation of constant value failed
--> $DIR/uninhabited.rs:87:9
   |
LL |         assert!(false);
   |         ^^^^^^^^^^^^^^ assertion failed: false
   |
   = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
```

### Remove duplicated span from const eval frame list

When the primary span for a const error is the same as the first frame in the const error report, skip it.

```
error[E0080]: evaluation of constant value failed
  --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24
   |
LL | const _CONST: &[u8] = &f(&[], |_| {});
   |                        ^^^^^^^^^^^^^^ explicit panic
   |
note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>`
  --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
   |
LL |     panic!()
   |     ^^^^^^^^ the failure occurred here
   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
```
instead of
```
error[E0080]: evaluation of constant value failed
--> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
   |
LL |     panic!()
   |     ^^^^^^^^ explicit panic
   |
note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>`
--> $DIR/issue-88434-removal-index-should-be-less.rs:10:5
   |
LL |     panic!()
   |     ^^^^^^^^
note: inside `_CONST`
--> $DIR/issue-88434-removal-index-should-be-less.rs:3:24
   |
LL | const _CONST: &[u8] = &f(&[], |_| {});
   |                        ^^^^^^^^^^^^^^
   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

note: erroneous constant encountered
--> $DIR/issue-88434-removal-index-should-be-less.rs:3:23
   |
LL | const _CONST: &[u8] = &f(&[], |_| {});
   |                       ^^^^^^^^^^^^^^^
```

r? ``@oli-obk``
2025-03-01 11:33:57 +01:00
..
intrinsic make simd_insert and simd_extract const fns 2025-02-27 12:23:00 +01:00
array-trait.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
array-trait.stderr tests: remove //@ pretty-expanded usages 2024-11-26 02:50:48 +08:00
array-type.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
const-err-trumps-simd-err.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
const-err-trumps-simd-err.stderr Shorten span of panic failures in const context 2025-02-28 16:28:41 +00:00
dont-invalid-bitcast-masks.rs test: dont optimize to invalid bitcasts 2024-06-24 16:54:18 -07:00
dont-invalid-bitcast-x86_64.rs test: dont optimize to invalid bitcasts 2024-06-24 16:54:18 -07:00
generics.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
issue-17170.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
issue-32947.rs run some tests on emscripten again 2025-02-24 19:48:24 +01:00
issue-39720.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
issue-85915-simd-ptrs.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
issue-89193.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
issue-105439.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
libm_no_std_cant_float.rs Update std::simd usage and test outputs 2023-11-26 09:02:25 -05:00
libm_no_std_cant_float.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
libm_std_can_float.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
masked-load-store-build-fail.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
masked-load-store-build-fail.stderr remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
masked-load-store-check-fail.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
masked-load-store-check-fail.stderr remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
masked-load-store.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
monomorphize-heterogeneous.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
monomorphize-heterogeneous.stderr Ban non-array SIMD 2024-09-09 19:39:43 -07:00
monomorphize-shuffle-index.generic.stderr remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
monomorphize-shuffle-index.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
monomorphize-too-long.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
monomorphize-too-long.stderr Ban non-array SIMD 2024-09-09 19:39:43 -07:00
monomorphize-zero-length.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
monomorphize-zero-length.stderr Ban non-array SIMD 2024-09-09 19:39:43 -07:00
not-out-of-bounds.rs simd_shuffle: require index argument to be a vector 2024-09-14 14:43:24 +02:00
not-out-of-bounds.stderr simd_shuffle: require index argument to be a vector 2024-09-14 14:43:24 +02:00
portable-intrinsics-arent-exposed.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
portable-intrinsics-arent-exposed.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
repr_packed.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
shuffle.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
simd-bitmask-notpow2.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
simd-bitmask.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
size-align.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
target-feature-mixup.rs tests: use needs-subprocess instead of ignore-{wasm32,emscripten,sgx} 2025-01-23 20:51:29 +08:00
type-generic-monomorphisation-empty.rs fix use of platform_intrinsics in tests 2024-02-25 08:15:44 +01:00
type-generic-monomorphisation-empty.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
type-generic-monomorphisation-extern-nonnull-ptr.rs Update tests. 2025-01-07 16:04:14 +01:00
type-generic-monomorphisation-non-primitive.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
type-generic-monomorphisation-non-primitive.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
type-generic-monomorphisation-oversized.rs fix use of platform_intrinsics in tests 2024-02-25 08:15:44 +01:00
type-generic-monomorphisation-oversized.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
type-generic-monomorphisation-power-of-two.rs fix use of platform_intrinsics in tests 2024-02-25 08:15:44 +01:00
type-generic-monomorphisation-wide-ptr.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
type-generic-monomorphisation-wide-ptr.stderr Ban non-array SIMD 2024-09-09 19:39:43 -07:00
type-generic-monomorphisation.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
type-generic-monomorphisation.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
type-len.rs Ban non-array SIMD 2024-09-09 19:39:43 -07:00
type-len.stderr Ban non-array SIMD 2024-09-09 19:39:43 -07:00
type-wide-ptr.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
type-wide-ptr.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
wasm-simd-indirect.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00