-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Extend E0106, E0261 #57310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend E0106, E0261 #57310
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,6 +362,10 @@ struct Foo1 { x: &bool } | |
// ^ expected lifetime parameter | ||
struct Foo2<'a> { x: &'a bool } // correct | ||
|
||
impl Foo2 { ... } | ||
// ^ expected lifetime parameter | ||
impl<'a> Foo2<'a> { ... } // correct | ||
|
||
struct Bar1 { x: Foo2 } | ||
// ^^^^ expected lifetime parameter | ||
struct Bar2<'a> { x: Foo2<'a> } // correct | ||
|
@@ -772,6 +776,24 @@ struct Foo<'a> { | |
x: &'a str, | ||
} | ||
``` | ||
|
||
Implementations need their own lifetime declarations: | ||
|
||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since these code blocks stand on their own, can you make sure to tag them with |
||
// error, undeclared lifetime | ||
impl Foo<'a> { | ||
... | ||
} | ||
``` | ||
|
||
Which are declared like this: | ||
|
||
``` | ||
// correct | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These code samples are tested, so please include the struct definition in this sample to make sure it properly compiles. |
||
impl<'a> Foo<'a> { | ||
... | ||
} | ||
``` | ||
"##, | ||
|
||
E0262: r##" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc suggestion: