rust/tests/ui/simd
Esteban Küber c439a59dbd Change the desugaring of assert! for better error output
In the desugaring of `assert!`, we now expand to a `match` expression
instead of `if !cond {..}`.

The span of incorrect conditions will point only at the expression, and not
the whole `assert!` invocation.

```
error[E0308]: mismatched types
  --> $DIR/issue-14091.rs:2:13
   |
LL |     assert!(1,1);
   |             ^ expected `bool`, found integer
```

We no longer mention the expression needing to implement the `Not` trait.

```
error[E0308]: mismatched types
  --> $DIR/issue-14091-2.rs:15:13
   |
LL |     assert!(x, x);
   |             ^ expected `bool`, found `BytePos`
```

`assert!(val)` now desugars to:

```rust
match val {
    true => {},
    _ => $crate::panic::panic_2021!(),
}
```

Fix #122159.

We make some minor changes to some diagnostics to avoid span overlap on
type mismatch or inverted "expected"/"found" on type errors.

We remove some unnecessary parens from core, alloc and miri.

address review comments
2025-08-12 16:30:48 +00:00
..
intrinsic Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
array-trait.rs remove most simd_ intrinsic declaration in tests 2025-02-27 12:22:59 +01:00
array-trait.stderr Unconditionally run check_item_type on all items 2025-06-30 08:06:08 +00: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 stabilize gai 2025-06-11 15:30:15 +01:00
const-err-trumps-simd-err.stderr Change the desugaring of assert! for better error output 2025-08-12 16:30:48 +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
empty-simd-vector-in-operand.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
empty-simd-vector-in-operand.stderr fix: running the test only on x86_64. 2025-03-23 19:42:14 +01:00
generics.rs So many test updates x_x 2025-07-20 10:15:14 -07:00
issue-17170.rs Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
issue-32947.rs run some tests on emscripten again 2025-02-24 19:48:24 +01:00
issue-39720.rs Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
issue-85915-simd-ptrs.rs So many test updates x_x 2025-07-20 10:15:14 -07:00
issue-89193.rs So many test updates x_x 2025-07-20 10:15:14 -07:00
issue-105439.rs Ban projecting into SIMD types [MCP838] 2025-07-20 10:22:09 -07: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 Use tcx.short_string() in more diagnostics 2025-08-07 21:18:00 +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 simd intrinsics with mask: accept unsigned integer masks 2025-04-20 12:25:27 +02:00
masked-load-store-build-fail.stderr simd intrinsics with mask: accept unsigned integer masks 2025-04-20 12:25:27 +02: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 Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02: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 So many test updates x_x 2025-07-20 10:15:14 -07:00
monomorphize-too-long.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
monomorphize-too-long.stderr Ban non-array SIMD 2024-09-09 19:39:43 -07:00
monomorphize-zero-length.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03: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-simd-on-enum.rs MIR-build: No longer emit assumes in enum-as casting 2025-07-24 10:18:37 -07:00
repr-simd-on-enum.stderr MIR-build: No longer emit assumes in enum-as casting 2025-07-24 10:18:37 -07:00
repr_packed.rs Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
shuffle.rs So many test updates x_x 2025-07-20 10:15:14 -07:00
simd-bitmask-notpow2.rs Add ignore-backends annotations in failing GCC backend ui tests 2025-07-23 13:48:04 +02:00
simd-bitmask.rs So many test updates x_x 2025-07-20 10:15:14 -07:00
size-align.rs intrinsics: rename min_align_of to align_of 2025-06-12 17:50:25 +02:00
target-feature-mixup.rs So many test updates x_x 2025-07-20 10:15:14 -07:00
type-generic-monomorphisation-empty.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03: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 compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03: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 compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03: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 compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03:00
type-generic-monomorphisation-wide-ptr.stderr Ban non-array SIMD 2024-09-09 19:39:43 -07:00
type-generic-monomorphisation.rs compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03: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 compiletest: Require //~ annotations even if error-pattern is specified 2025-04-03 11:08:55 +03: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