-
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
Erroneous borrow error from 2018 edition's NLL migration mode. #52967
Comments
Smaller example (playground): fn main() {
let mut stuff = ("left", "right");
match stuff {
(ref mut left, _) if *left == "left" => { }
_ => {}
}
} which emits the diagnostic:
|
Here's the (very?) good news: this is not an NLL bug, per se. In particular, when we opt into NLL explicitly, the example works (playground): #![feature(nll)]
fn main() {
let mut stuff = ("left", "right");
match stuff {
(ref mut left, _) if *left == "left" => { }
_ => {}
}
} There is a bug in how I linked the migration mode into the 2018 edition (PR #52681). Basically, its not toggling on enough switches, and one of the ones I missed is causing something to break with the new way we handle |
This issue strikes me as an argument that we should turn on something analogous to |
In particular, you see the error with |
…ase-borrows, r=Mark-Simulacrum NLL migration in the 2018 edition needs two-phase borrows too! NLL migration in the 2018 edition needs two-phase borrows too! Fix #52967.
I have:
(from https://github.com/rust-lang-nursery/rls/blob/master/src/config.rs#L238-L277)
And I get the following warning:
The warning is the same without the
&mut
.It seems to me this code is fine and there should not be a warning.
cc @nikomatsakis @pnkfelix
The text was updated successfully, but these errors were encountered: