Closed
Description
Take this code:
trait Foo { type Value: 'static; }
fn require_static<T: 'static>() {}
fn takes_foo<F: Foo>() {
require_static::<F::Value>()
}
Since Foo::Value
is bounded with 'static
, we would expect this to compile, but instead we get this error message:
<anon>:6:3: 6:29 error: the associated type `<F as Foo>::Value` may not live long enough
<anon>:6 require_static::<F::Value>()
^~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:6:3: 6:29 help: consider adding an explicit lifetime bound `<F as Foo>::Value: 'static`...
<anon>:6 require_static::<F::Value>()
^~~~~~~~~~~~~~~~~~~~~~~~~~
<anon>:6:3: 6:29 note: ...so that the declared lifetime parameter bounds are satisfied
<anon>:6 require_static::<F::Value>()
^~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
Which seems redundant, if not incorrect.
playpen: http://is.gd/UkEaDV
cc @nikomatsakis from IRC