Closed
Description
trait Base<'self,A> {
fn foo(&self, blk: &fn(v: &'self A));
}
struct Bar<A> {
a: A,
}
impl<'self,A> Base<'self,A> for Bar<A> {
fn foo(&self, blk: &fn(v: &'self A)) {
blk(&self.a);
}
}
fn bar<'r,A,IA:Base<'r,A>>(b: &'r Bar<A>, blk: &fn(&'r A)) {
b.foo(blk);
}
test3.rs:15:22: 15:23 error: Illegal lifetime 'r: only 'static is allowed here
test3.rs:15 fn bar<'r,A,IA:Base<'r,A>>(b: &'r Bar<A>, blk: &fn(&'r A)) {
^
error: aborting due to previous error
Seems like this should work, since without the lifetimes involved, fn bar<A,IA:Base<A>>(...)
works fine - the earlier type declaration of A
makes it possible to use A
as a parameter in the type bound.
Metadata
Metadata
Assignees
Labels
No labels