@@ -1527,6 +1527,37 @@ fn main() {
1527
1527
```
1528
1528
"## ,
1529
1529
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
+
1530
1561
E0496 : r##"
1531
1562
A lifetime name is shadowing another lifetime name. Erroneous code example:
1532
1563
@@ -1715,7 +1746,6 @@ register_diagnostics! {
1715
1746
E0475 , // index of slice outside its lifetime
1716
1747
E0476 , // lifetime of the source pointer does not outlive lifetime bound...
1717
1748
E0477 , // the type `..` does not fulfill the required lifetime...
1718
- E0478 , // lifetime bound not satisfied
1719
1749
E0479 , // the type `..` (provided as the value of a type parameter) is...
1720
1750
E0480 , // lifetime of method receiver does not outlive the method call
1721
1751
E0481 , // lifetime of function argument does not outlive the function call
0 commit comments