-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Matching strings in beta and nightly #35044
Comments
The MIR looks fine, and it works fine with |
I think I broke old trans |
Can we enforce MIR trans whenever slice patterns are in use? |
Update from @rust-lang/compiler meeting. @eddyb took a stab at fixing it but did not succeed. The problem is that, in the old code, literals (like @eddyb points out that, on stable, this code does not currently compile. So to fix this for beta we could add some custom check that denies using |
Before PR rust-lang#32202, check_match tended to report bogus errors or ICE when encountering a pattern that split a literal, e.g. ```Rust match foo { "bar" => {}, &_ => {} } ``` That PR fixed these issues, but trans::_match generates bad code when it encounters these matches. MIR trans has that fixed, but it is waiting for 6 weeks in beta. Report an error when encountering these instead. Fixes issue rust-lang#35044.
This is actually fixed on beta. |
Before PR rust-lang#32202, check_match tended to report bogus errors or ICE when encountering a pattern that split a literal, e.g. ```Rust match foo { "bar" => {}, &_ => {} } ``` That PR fixed these issues, but trans::_match generates bad code when it encounters these matches. MIR trans has that fixed, but it is waiting for 6 weeks in beta. Report an error when encountering these instead. Fixes issue rust-lang#35044.
when matching &str in nightly or beta the following code always returns the first match case:
Expected behaviour is returning the fitting case. This can be fixed by removing the "&" in front of the last case.
Meta
tested on my machine with: rustc 1.11.0-nightly (bb4a79b 2016-06-15)
tested on here with beta and nightly showing the bug and stable giving a runtime error.
The text was updated successfully, but these errors were encountered: