Created
February 13, 2013 21:20
-
-
Save alexcrichton/4948417 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
thing: &int // errors don't happen unless this field is a borrowed pointer | |
} | |
impl Foo { | |
fn run(&mut self) { | |
self.foo(); | |
self.bar(); | |
} | |
fn bar(&mut self) {} | |
fn foo(&mut self) {} | |
} | |
This file contains hidden or 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:8:4: 8:8 error: loan of dereference of mutable & pointer as mutable conflicts with prior loan | |
foo.rs:8 self.bar(); | |
^~~~ | |
foo.rs:7:4: 7:8 note: prior loan as mutable granted here | |
foo.rs:7 self.foo(); | |
^~~~ | |
error: aborting due to previous error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment