@@ -1527,6 +1527,37 @@ fn main() {
15271527```
15281528"## ,
15291529
1530+ E0478 : r##"
1531+ A lifetime bound was not satisfied.
1532+
1533+ Erroneous code example:
1534+
1535+ ```compile_fail,E0478
1536+ // Check that the explicit lifetime bound (`'SnowWhite`, in this example) must
1537+ // outlive all the superbounds from the trait (`'kiss`, in this example).
1538+
1539+ trait Wedding<'t>: 't { }
1540+
1541+ struct Prince<'kiss, 'SnowWhite> {
1542+ child: Box<Wedding<'kiss> + 'SnowWhite>,
1543+ // error: lifetime bound not satisfied
1544+ }
1545+ ```
1546+
1547+ In this example, the `'SnowWhite` lifetime is supposed to outlive the `'kiss`
1548+ lifetime but the declaration of the `Prince` struct doesn't enforce it. To fix
1549+ this issue, you need to specify it:
1550+
1551+ ```
1552+ trait Wedding<'t>: 't { }
1553+
1554+ struct Prince<'kiss, 'SnowWhite: 'kiss> { // You say here that 'kiss must live
1555+ // longer than 'SnowWhite.
1556+ child: Box<Wedding<'kiss> + 'SnowWhite>, // And now it's all good!
1557+ }
1558+ ```
1559+ "## ,
1560+
15301561E0496 : r##"
15311562A lifetime name is shadowing another lifetime name. Erroneous code example:
15321563
@@ -1715,7 +1746,6 @@ register_diagnostics! {
17151746 E0475 , // index of slice outside its lifetime
17161747 E0476 , // lifetime of the source pointer does not outlive lifetime bound...
17171748 E0477 , // the type `..` does not fulfill the required lifetime...
1718- E0478 , // lifetime bound not satisfied
17191749 E0479 , // the type `..` (provided as the value of a type parameter) is...
17201750 E0480 , // lifetime of method receiver does not outlive the method call
17211751 E0481 , // lifetime of function argument does not outlive the function call
0 commit comments