-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics
Description
Fix the formatting of self
in the error message.
struct Foo {
field: i32
}
impl Foo {
fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
if true { self } else { x }
// now gives:
// error[E0611]: explicit lifetime required in the type of `self`
// |
// 20 | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
// | ^^^^^ consider changing the type of `self` to `&'a Foo`
// ...
// 25 | if true { self } else { x }
// | ---- lifetime `'a` required
// should actually:
// error[E0611]: explicit lifetime required in the type of `self`
// |
// 20 | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
// | ^^^^^ consider changing to `&'a self`
// ...
// 25 | if true { self } else { x }
// | ---- lifetime `'a` required
}
}
^^^^^ consider changing the type of `self` to `&'a Foo`
should actually be
^^^^^ consider changing to `&'a self`
kennytm
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.WG-diagnosticsWorking group: DiagnosticsWorking group: Diagnostics