-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE with byte char literal in match #17631
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Comments
Doesn't require byte literals. It just requires two integral literals, one which is known at const-eval time to be unsigned, and one which is unknown (and therefore defaults to signed): pub fn main() {
let (a, b) = (1u8, 2u8);
let _x = match (a, b) {
(0x1b, 0x01) => 1u,
(_, 0x05u8) => 2u,
_ => 5u
};
} |
Oddly, if I try a simpler version: pub fn main() {
match 5u8 {
1 => (),
2u8 => (),
_ => ()
}
} I get a type error:
Even though it seems like this should work just fine. I don't know why the previous version works. |
cc #16745 |
Triage: I still get an ICE today. |
Compiles without issue. pub fn main() {
let (a, b) = (1u8, 2u8);
let _x = match (a, b) {
(0x1b, b'\\') => 1u8,
(_, 0x05) => 2u8,
_ => 5u8,
};
} |
cc @jakub- because #18538 |
lnicola
pushed a commit
to lnicola/rust
that referenced
this issue
Sep 25, 2024
feat: better name suggestions for fn fix rust-lang#17631. Better name suggestions for fn-calls / method-calls in the form of `from()`, `from_xxx()`, `into()`, etc.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Using a
b'x'
literal in amatch
in one arm when another arm uses an integral literal causes an ICE.Code:
Results:
The text was updated successfully, but these errors were encountered: