]> git.lizzy.rs Git - rust.git/commitdiff
E0106: field lifetimes
authorAnthony Defranceschi <chaacygg@gmail.com>
Wed, 16 Aug 2017 20:49:18 +0000 (22:49 +0200)
committerAnthony Defranceschi <chaacygg@gmail.com>
Wed, 16 Aug 2017 20:49:18 +0000 (22:49 +0200)
I've added an example for custom type lifetimes located in another `struct` fields.

src/librustc/diagnostics.rs

index 522c1531c593804228a9bbad830df4d7756ef6d0..48f2d0b3198eb1c02af66ec10f4eb26bc7edd22c 100644 (file)
@@ -362,6 +362,10 @@ enum Enum {
 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