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 }
362
362
// ^ expected lifetime parameter
363
363
struct Foo2<'a> { x: &'a bool } // correct
364
364
365
+ impl Foo2 { ... }
366
+ // ^ expected lifetime parameter
367
+ impl<'a> Foo2<'a> { ... } // correct
368
+
365
369
struct Bar1 { x: Foo2 }
366
370
// ^^^^ expected lifetime parameter
367
371
struct Bar2<'a> { x: Foo2<'a> } // correct
@@ -772,6 +776,24 @@ struct Foo<'a> {
772
776
x: &'a str,
773
777
}
774
778
```
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
+ ```
775
797
"## ,
776
798
777
799
E0262 : r##"
You can’t perform that action at this time.
0 commit comments