diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-04-15 15:47:25 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-15 15:47:25 +1000 |
| commit | aa9a80cc34065197a5ea8e4c58efa30b04de1919 (patch) | |
| tree | fe5df4700757ea1bd89431f0a21f6e79a3981144 /compiler/rustc_codegen_llvm/src/errors.rs | |
| parent | b8413ab8edb382cd4c55497a07a02bbc165005fe (diff) | |
| parent | 7ad16974b995746b9156d90b8b80fb137afcd1e9 (diff) | |
| download | rust-aa9a80cc34065197a5ea8e4c58efa30b04de1919.tar.gz rust-aa9a80cc34065197a5ea8e4c58efa30b04de1919.zip | |
Rollup merge of #138393 - oli-obk:pattern-type-in-pattern, r=BoxyUwU
Allow const patterns of matches to contain pattern types
Trying to pattern match on a type containing a pattern type will currently fail with an ICE
```rust
error: internal compiler error: compiler/rustc_mir_build/src/builder/matches/test.rs:459:18: invalid type for non-scalar compare: (u32) is 1..
--> src/main.rs:22:5
|
22 | TWO => {}
| ^^^
```
because the compiler tries to generate a MIR `BinOp(Eq)` operation on a pattern type, which is not supported. While we could support that, there are side effects of allowing this (none that would compile, but the compiler would simultaneously think it could `==` pattern types and that it could not because `PartialEq` is not implemented. So instead I change the logic for pattern matching to transmute pattern types to their base type before comparing.
r? ```@BoxyUwU```
cc #123646 ```@scottmcm``` ```@joshtriplett```
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
