File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -362,6 +362,10 @@ struct Foo1 { x: &bool }
362362 // ^ expected lifetime parameter
363363struct Foo2<'a> { x: &'a bool } // correct
364364
365+ impl Foo2 { ... }
366+ // ^ expected lifetime parameter
367+ impl<'a> Foo2<'a> { ... } // correct
368+
365369struct Bar1 { x: Foo2 }
366370 // ^^^^ expected lifetime parameter
367371struct Bar2<'a> { x: Foo2<'a> } // correct
@@ -772,6 +776,24 @@ struct Foo<'a> {
772776 x: &'a str,
773777}
774778```
779+
780+ Implementations need their own lifetime declarations:
781+
782+ ```
783+ // error, undeclared lifetime
784+ impl Foo<'a> {
785+ ...
786+ }
787+ ```
788+
789+ Which are declared like this:
790+
791+ ```
792+ // correct
793+ impl<'a> Foo<'a> {
794+ ...
795+ }
796+ ```
775797"## ,
776798
777799E0262 : r##"
You can’t perform that action at this time.
0 commit comments