Open
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`