rust/tests/ui/codemap_tests
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
..
bad-format-args.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
bad-format-args.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coherence-overlapping-inherent-impl-trait.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
coherence-overlapping-inherent-impl-trait.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
empty_span.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
empty_span.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
huge_multispan_highlight.ascii.svg Filter empty lines, comments and delimiters from previous to last multiline span rendering 2024-12-12 23:36:27 +00:00
huge_multispan_highlight.rs Don't allow -Zunstable-options to take a value 2024-11-18 18:04:59 +11:00
huge_multispan_highlight.unicode.svg Filter empty lines, comments and delimiters from previous to last multiline span rendering 2024-12-12 23:36:27 +00:00
issue-11715.rs Remove attribute #[rustc_error] 2025-03-30 01:32:21 +03:00
issue-11715.stderr Remove attribute #[rustc_error] 2025-03-30 01:32:21 +03:00
issue-28308.rs Change the desugaring of assert! for better error output 2025-08-12 16:30:48 +00:00
issue-28308.stderr Change the desugaring of assert! for better error output 2025-08-12 16:30:48 +00:00
one_line.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
one_line.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
overlapping_inherent_impls.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
overlapping_inherent_impls.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
tab.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
tab.stderr Point to where missing return type should go 2023-10-04 21:09:54 +00:00
tab_2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
tab_2.stderr Refactor emitter to better account for unicode chars when trimming 2025-03-07 17:55:08 +00:00
tab_3.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
tab_3.stderr Show number in error message even for one error 2023-11-24 19:15:52 +01:00
two_files.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
two_files.stderr Show diff suggestion format on verbose replacement 2025-02-10 20:21:39 +00:00
two_files_data.rs tests: use //@ ignore-auxiliary with backlinked primary test file 2025-04-17 19:45:28 +08:00
unicode.expanded.stdout expand: Micro-optimize prelude injection 2025-07-28 17:35:09 +03:00
unicode.normal.stderr Explicitly annotate edition for unpretty=expanded and unpretty=hir tests 2025-04-16 11:10:10 +02:00
unicode.rs Explicitly annotate edition for unpretty=expanded and unpretty=hir tests 2025-04-16 11:10:10 +02:00
unicode_2.rs Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unicode_2.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
unicode_3.rs [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
unicode_3.stderr Move /src/test to /tests 2023-01-11 09:32:08 +00:00
utf8-bom.rs Move more tests/ui tests 2025-05-12 16:35:09 +02:00