-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE with byte char literal in match #17631
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 |
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.
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: