Last active
December 11, 2015 17:48
-
-
Save alexcrichton/4637357 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Foo { | |
foo : &int, | |
} | |
impl Foo { | |
fn a(&mut self) {} | |
} | |
fn main() { | |
let mut l = Foo { foo: &4 }; | |
l.a(); | |
l.a(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ rustc --test foo.rs | |
foo.rs:12:2: 12:3 error: loan of mutable local variable as mutable conflicts with prior loan | |
foo.rs:12 l.a(); | |
^ | |
foo.rs:11:2: 11:3 note: prior loan as mutable granted here | |
foo.rs:11 l.a(); | |
^ | |
error: aborting due to previous error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment