-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)
Description
This example http://is.gd/96g9Eb yields odd errors:
pub trait Foo {
type Bar;
fn foo(&self) -> Self;
}
pub struct Static<T:'static>(T);
struct Bar<T:Foo>
where T::Bar : 'static
{
x: Static<Option<T::Bar>>
}
fn main() { }
Yields:
<anon>:9:1: 13:2 error: the parameter type `T` may not live long enough
<anon>:9 struct Bar<T:Foo>
<anon>:10 where T::Bar : 'static
<anon>:11 {
<anon>:12 x: Static<Option<T::Bar>>
<anon>:13 }
<anon>:9:1: 13:2 help: consider adding an explicit lifetime bound `T: 'static`...
<anon>:9 struct Bar<T:Foo>
<anon>:10 where T::Bar : 'static
<anon>:11 {
<anon>:12 x: Static<Option<T::Bar>>
<anon>:13 }
<anon>:9:1: 13:2 note: ...so that the reference type `Static<core::option::Option<<T as Foo>::Bar>>` does not outlive the data it points at
<anon>:9 struct Bar<T:Foo>
<anon>:10 where T::Bar : 'static
<anon>:11 {
<anon>:12 x: Static<Option<T::Bar>>
<anon>:13 }
error: aborting due to previous error
playpen: application terminated with error code 101
The cause is the regionmanip code which is recursively enforcing predicates on the input types of the projection; I suspect this is just not really necessary.
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)