-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait system
Description
Minimal example:
trait A: 'static { }
impl<'a> A for &'a A { }
fn main() { }(&'a A can be written &'a (A + 'static) with the same outcome.)
<anon>:2:1: 2:25 error: declared lifetime bound not satisfied
<anon>:2 impl<'a> A for &'a A { }
^~~~~~~~~~~~~~~~~~~~~~~~
<anon>:2:1: 2:25 note: lifetime parameter instantiated with the lifetime 'a as defined on the impl at 2:0
<anon>:2 impl<'a> A for &'a A { }
^~~~~~~~~~~~~~~~~~~~~~~~
note: but lifetime parameter must outlive the static lifetime
error: aborting due to previous error
Sure, A itself must be 'static, but that shouldn’t prevent the creation of a non-static reference to A.
Metadata
Metadata
Assignees
Labels
A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait system