diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-01-08 18:21:00 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-08 18:21:00 +0100 |
| commit | f92a5ed5b42c5ea551b6708bdd06557973ba7d76 (patch) | |
| tree | 570a3c9adbe86c99df7e26fa9d9eed9294afd3f4 /compiler/rustc_codegen_llvm/src/errors.rs | |
| parent | 6afee111c2faf86ba884ea748967130abad37b52 (diff) | |
| parent | 4a8773a3afce505ee861ba342ff9217caf9dfee8 (diff) | |
| download | rust-f92a5ed5b42c5ea551b6708bdd06557973ba7d76.tar.gz rust-f92a5ed5b42c5ea551b6708bdd06557973ba7d76.zip | |
Rollup merge of #134228 - oli-obk:pat-lit-path, r=compiler-errors
Exhaustively handle expressions in patterns
We currently have this invariant in HIR that a `PatKind::Lit` or a `PatKind::Range` only contains
* `ExprKind::Lit`
* `ExprKind::UnOp(Neg, ExprKind::Lit)`
* `ExprKind::Path`
* `ExprKind::ConstBlock`
So I made `PatKind::Lit` and `PatKind::Range` stop containing `Expr`, and instead created a `PatLit` type whose `kind` enum only contains those variants.
The only place code got more complicated was in clippy, as it couldn't share as much anymore with `Expr` handling
It may be interesting on merging `ExprKind::{Path,Lit,ConstBlock}` in the future and using the same `PatLit` type (under a new name).
Then it should also be easier to eliminate any and all `UnOp(Neg, Lit) | Lit` matching that we have across the compiler. Some day we should fold the negation into the literal itself and just store it on the numeric literals
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
