fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
1.2 KiB34 linesraw
1error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
2  --> $DIR/regions-creating-enums4.rs:7:5
3   |
4LL |     Ast::Add(x, y)
5   |     ^^^^^^^^
6   |
7note: first, the lifetime cannot outlive the lifetime `'a` as defined on the function body at 6:16...
8  --> $DIR/regions-creating-enums4.rs:6:16
9   |
10LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> {
11   |                ^^
12note: ...so that the expression is assignable
13  --> $DIR/regions-creating-enums4.rs:7:14
14   |
15LL |     Ast::Add(x, y)
16   |              ^
17   = note: expected  `&Ast<'_>`
18              found  `&Ast<'a>`
19note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 6:19...
20  --> $DIR/regions-creating-enums4.rs:6:19
21   |
22LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> {
23   |                   ^^
24note: ...so that the expression is assignable
25  --> $DIR/regions-creating-enums4.rs:7:5
26   |
27LL |     Ast::Add(x, y)
28   |     ^^^^^^^^^^^^^^
29   = note: expected  `Ast<'b>`
30              found  `Ast<'_>`
31
32error: aborting due to previous error
33
34For more information about this error, try `rustc --explain E0495`.