rust/compiler/rustc_pattern_analysis/src
Matthias Krüger ceeaa8a852
Rollup merge of #120517 - Nadrieril:lower-never-as-wildcard, r=compiler-errors
never patterns: It is correct to lower `!` to `_`.

This is just a comment update but a non-trivial one: it is correct to lower `!` patterns as `_`. The reasoning is that `!` matches all the possible values of the type, since the type is empty. Moreover, we do want to warn that the `Err` is redundant in:
```rust
match x {
  !,
  Err(!),
}
```
which is consistent with `!` behaving like a wildcard.

I did try to introduce `Constructor::Never` and it ended up needing to behave exactly like `Constructor::Wildcard`.

r? ```@compiler-errors```
2024-02-03 22:25:15 +01:00
..
constructor.rs Rollup merge of #120516 - Nadrieril:cleanup-impls, r=compiler-errors 2024-02-03 22:25:14 +01:00
errors.rs s/RustcCtxt/RustcMatchCheckCtxt/ 2023-12-15 16:58:38 +01:00
lib.rs Make PatternColumn part of the public API 2024-01-30 17:06:52 +01:00
lints.rs Make PatternColumn part of the public API 2024-01-30 17:06:52 +01:00
pat.rs Rollup merge of #120516 - Nadrieril:cleanup-impls, r=compiler-errors 2024-02-03 22:25:14 +01:00
pat_column.rs Make PatternColumn part of the public API 2024-01-30 17:06:52 +01:00
rustc.rs Rollup merge of #120517 - Nadrieril:lower-never-as-wildcard, r=compiler-errors 2024-02-03 22:25:15 +01:00
usefulness.rs Rollup merge of #120516 - Nadrieril:cleanup-impls, r=compiler-errors 2024-02-03 22:25:14 +01:00