Last active
August 29, 2015 14:08
-
-
Save stepancheg/abb2b6ef3305945b270b 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
tmp.rs:8:9: 8:13 error: `copy` does not live long enough | |
tmp.rs:8 copy.walk(|a| callback(a)); | |
^~~~ | |
tmp.rs:6:45: 9:6 note: reference must be valid for the lifetime 'a as defined on the block at 6:44... | |
tmp.rs:6 fn walk(&'a self, callback: |&Aaa<'a>|) { | |
tmp.rs:7 let copy = Aaa { dummy: self.dummy }; | |
tmp.rs:8 copy.walk(|a| callback(a)); | |
tmp.rs:9 } | |
tmp.rs:6:45: 9:6 note: ...but borrowed value is only valid for the block at 6:44 | |
tmp.rs:6 fn walk(&'a self, callback: |&Aaa<'a>|) { | |
tmp.rs:7 let copy = Aaa { dummy: self.dummy }; | |
tmp.rs:8 copy.walk(|a| callback(a)); | |
tmp.rs:9 } | |
error: aborting due to previous error |
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 Aaa<'a> { | |
dummy: &'a u32, | |
} | |
impl<'a> Aaa<'a> { | |
fn walk(&'a self, callback: |&Aaa<'a>|) { | |
let copy = Aaa { dummy: self.dummy }; | |
copy.walk(|a| callback(a)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment