You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #47596, @SimonSapin reported several NLL errors in dependencies of the servo crate. @lqd later minimized one of those errors into this example:
#![feature(nll)]enumSplitWithinState{A,B}fneach_split_within(){letmut state = SplitWithinState::A;letmut closure = || { state = SplitWithinState::A};ifletSplitWithinState::A = state {}closure();}fnmain(){}
which yields:
error[E0503]: cannot use `state` because it was mutably borrowed
--> src/main.rs:8:12
|
7 | let mut closure = || { state = SplitWithinState::A };
| ---------------------------------- borrow of `state` occurs here
8 | if let SplitWithinState::A = state {
| ^^^^^^^^^^^^^^^^^^^ use of borrowed `state`
error: aborting due to previous error
That said, at first glance, this looks like it might be a bug fix -- the closure is assigning to state, so it has a mutable borrow, and the if let is testing it. Pretty sure this is #45045.
The text was updated successfully, but these errors were encountered:
In #47596, @SimonSapin reported several NLL errors in dependencies of the servo crate. @lqd later minimized one of those errors into this example:
which yields:
That said, at first glance, this looks like it might be a bug fix -- the
closure
is assigning tostate
, so it has a mutable borrow, and theif let
is testing it. Pretty sure this is #45045.The text was updated successfully, but these errors were encountered: