mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
E0106: field lifetimes
I've added an example for custom type lifetimes located in another `struct` fields.
This commit is contained in:
parent
00a6797f05
commit
fe06b70b2a
@ -362,6 +362,10 @@ Here are some simple examples of where you'll run into this error:
|
||||
struct Foo { x: &bool } // error
|
||||
struct Foo<'a> { x: &'a bool } // correct
|
||||
|
||||
struct Bar{ x: Foo }
|
||||
^^^ expected lifetime parameter
|
||||
struct Bar<'a>{ x: Foo<'a> } // correct
|
||||
|
||||
enum Bar { A(u8), B(&bool), } // error
|
||||
enum Bar<'a> { A(u8), B(&'a bool), } // correct
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user