Closed
Description
Compiling this code gives you an error message, but not the right one. I get
reference is not valid outside of its lifetime, &self
which suggests that some substitution is not occuring, as I would expect &self to be replaced with the free & region defined in the callback. Maybe the same bug as @catamorphism diagnosed regarding the replacement of ty params with tyvars in the vtable code.
iface deref {
fn get() -> int;
}
impl of deref for &int {
fn get() -> int {
*self
}
}
fn with<R: deref>(f: fn(x: &int) -> R) -> int {
f(&3).get()
}
fn return_it() -> int {
with(|o| o)
}
fn main() {
let x = return_it();
#debug["foo=%d", x];
}