Created
September 28, 2013 19:53
-
-
Save jmcarthur/6745884 to your computer and use it in GitHub Desktop.
A little experiment that has led to a question about lifetimes in Rust.
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 Thunk<'a, T> { | |
f : ~fn() -> & 'a T | |
} |
struct Thunk {
f : ~fn<'a> (& 'a mut Thunk) -> & 'a T
}
impl Thunk {
fn force <'a> (& 'a mut self) -> & 'a T {
return (self.f) (self);
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello.rs:2:22: 2:23 error: Illegal lifetime 'a: this lifetime must be declared
hello.rs:2 f : ~fn() -> & 'a T