fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.0 KiB26 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   |                ^^
12   = note: ...so that the expression is assignable:
13           expected &Ast<'_>
14              found &Ast<'a>
15note: but, the lifetime must be valid for the lifetime `'b` as defined on the function body at 6:19...
16  --> $DIR/regions-creating-enums4.rs:6:19
17   |
18LL | fn mk_add_bad2<'a,'b>(x: &'a Ast<'a>, y: &'a Ast<'a>, z: &Ast) -> Ast<'b> {
19   |                   ^^
20   = note: ...so that the expression is assignable:
21           expected Ast<'b>
22              found Ast<'_>
23
24error: aborting due to previous error
25
26For more information about this error, try `rustc --explain E0495`.