@@ -1399,6 +1399,38 @@ struct Foo<T: 'static> {
13991399```
14001400"## ,
14011401
1402+ E0312 : r##"
1403+ A lifetime of reference outlives lifetime of borrowed content.
1404+
1405+ Erroneous code example:
1406+
1407+ ```compile_fail,E0312
1408+ fn make_child<'human, 'elve>(x: &mut &'human isize, y: &mut &'elve isize) {
1409+ *x = *y;
1410+ // error: lifetime of reference outlives lifetime of borrowed content
1411+ }
1412+ ```
1413+
1414+ The compiler cannot determine if the `human` lifetime will live long enough
1415+ to keep up on the elve one. To solve this error, you have to give an
1416+ explicit lifetime hierarchy:
1417+
1418+ ```
1419+ fn make_child<'human, 'elve: 'human>(x: &mut &'human isize,
1420+ y: &mut &'elve isize) {
1421+ *x = *y; // ok!
1422+ }
1423+ ```
1424+
1425+ Or use the same lifetime for every variable:
1426+
1427+ ```
1428+ fn make_child<'elve>(x: &mut &'elve isize, y: &mut &'elve isize) {
1429+ *x = *y; // ok!
1430+ }
1431+ ```
1432+ "## ,
1433+
14021434E0398 : r##"
14031435In Rust 1.3, the default object lifetime bounds are expected to change, as
14041436described in RFC #1156 [1]. You are getting a warning because the compiler
@@ -1674,7 +1706,6 @@ register_diagnostics! {
16741706// E0304, // expected signed integer constant
16751707// E0305, // expected constant
16761708 E0311 , // thing may not live long enough
1677- E0312 , // lifetime of reference outlives lifetime of borrowed content
16781709 E0313 , // lifetime of borrowed pointer outlives lifetime of captured variable
16791710 E0314 , // closure outlives stack frame
16801711 E0315 , // cannot invoke closure outside of its lifetime
0 commit comments