rust/tests
Matthias Krüger 7fc2b33722
Rollup merge of #132708 - estebank:const-as-binding, r=Nadrieril
Point at `const` definition when used instead of a binding in a `let` statement

Modify `PatKind::InlineConstant` to be `ExpandedConstant` standing in not only for inline `const` blocks but also for `const` items. This allows us to track named `const`s used in patterns when the pattern is a single binding. When we detect that there is a refutable pattern involving a `const` that could have been a binding instead, we point at the `const` item, and suggest renaming. We do this for both `let` bindings and `match` expressions missing a catch-all arm if there's at least one single binding pattern referenced.

After:

```
error[E0005]: refutable pattern in local binding
  --> $DIR/bad-pattern.rs:19:13
   |
LL |     const PAT: u32 = 0;
   |     -------------- missing patterns are not covered because `PAT` is interpreted as a constant pattern, not a new variable
...
LL |         let PAT = v1;
   |             ^^^ pattern `1_u32..=u32::MAX` not covered
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
   = note: the matched value is of type `u32`
help: introduce a variable instead
   |
LL |         let PAT_var = v1;
   |             ~~~~~~~
```

Before:

```
error[E0005]: refutable pattern in local binding
  --> $DIR/bad-pattern.rs:19:13
   |
LL |         let PAT = v1;
   |             ^^^
   |             |
   |             pattern `1_u32..=u32::MAX` not covered
   |             missing patterns are not covered because `PAT` is interpreted as a constant pattern, not a new variable
   |             help: introduce a variable instead: `PAT_var`
   |
   = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
   = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
   = note: the matched value is of type `u32`
```

CC #132582.
2024-11-20 20:10:12 +01:00
..
assembly tests: use max-llvm-major-version instead of ignore-llvm-version range like N - 99 2024-11-14 17:44:54 +08:00
auxiliary Fix typo in tests/auxiliary/minicore.rs 2024-11-03 17:32:33 +09:00
codegen Likely unlikely fix 2024-11-17 21:49:10 +01:00
codegen-units
coverage coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
coverage-run-rustdoc coverage: Restrict empty-span expansion to only cover { and } 2024-11-08 20:43:08 +11:00
crashes Auto merge of #133205 - matthiaskrgr:rollup-xhhhp5u, r=matthiaskrgr 2024-11-19 16:31:58 +00:00
debuginfo Mark numeric-types.rs as 64-bit only for now 2024-11-17 04:16:59 +08:00
incremental fixup some test directives 2024-11-17 22:15:54 +00:00
mir-opt Likely unlikely fix 2024-11-17 21:49:10 +01:00
pretty Add pretty, ui, and feature-gate tests for the enzyme/autodiff frontend 2024-10-11 20:38:43 +02:00
run-make Auto merge of #132646 - jieyouxu:liberate-aarch64-gnu-debug, r=Kobzol 2024-11-17 20:51:52 +00:00
rustdoc Add regression test for jump to def links on items with generics 2024-11-18 18:11:50 +01:00
rustdoc-gui rustdoc-search: simplify rules for generics and type params 2024-10-30 12:27:48 -07:00
rustdoc-js rustdoc-search: add standalone trailing :: test 2024-11-17 08:07:16 -07:00
rustdoc-js-std rustdoc search: allow queries to end in an empty path segment 2024-11-15 16:32:40 -06:00
rustdoc-json Rename Receiver -> LegacyReceiver 2024-10-22 12:55:16 +00:00
rustdoc-ui Auto merge of #126597 - estebank:unicode-output, r=fmease 2024-11-11 00:00:58 +00:00
ui Rollup merge of #132708 - estebank:const-as-binding, r=Nadrieril 2024-11-20 20:10:12 +01:00
ui-fulldeps Likely unlikely fix 2024-11-17 21:49:10 +01:00
COMPILER_TESTS.md