Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

type parameter bounds can't use already defined lifetimes #5715

doy opened this Issue Apr 4, 2013 · 1 comment


None yet
2 participants

doy commented Apr 4, 2013

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)) {

fn bar<'r,A,IA:Base<'r,A>>(b: &'r Bar<A>, blk: &fn(&'r A)) {
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.


nikomatsakis commented Apr 5, 2013

dup of #5121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment