]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.stderr
38b0acf9339e0e89595a6c0ee889abca1f2c221e
[rust.git] / src / test / ui / lifetime-errors / ex2d-push-inference-variable-2.stderr
1 error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
2   --> $DIR/ex2d-push-inference-variable-2.rs:17:13
3    |
4 17 |     let b = Ref { data: y.data };
5    |             ^^^
6    |
7 note: first, the lifetime cannot outlive the lifetime 'c as defined on the function body at 15:1...
8   --> $DIR/ex2d-push-inference-variable-2.rs:15:1
9    |
10 15 | / fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
11 16 | |     let a: &mut Vec<Ref<i32>> = x;
12 17 | |     let b = Ref { data: y.data };
13 18 | |     a.push(b);
14 19 | | }
15    | |_^
16 note: ...so that reference does not outlive borrowed content
17   --> $DIR/ex2d-push-inference-variable-2.rs:17:25
18    |
19 17 |     let b = Ref { data: y.data };
20    |                         ^^^^^^
21 note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 15:1...
22   --> $DIR/ex2d-push-inference-variable-2.rs:15:1
23    |
24 15 | / fn foo<'a, 'b, 'c>(x: &'a mut Vec<Ref<'b, i32>>, y: Ref<'c, i32>) {
25 16 | |     let a: &mut Vec<Ref<i32>> = x;
26 17 | |     let b = Ref { data: y.data };
27 18 | |     a.push(b);
28 19 | | }
29    | |_^
30 note: ...so that expression is assignable (expected &mut std::vec::Vec<Ref<'_, i32>>, found &mut std::vec::Vec<Ref<'b, i32>>)
31   --> $DIR/ex2d-push-inference-variable-2.rs:16:33
32    |
33 16 |     let a: &mut Vec<Ref<i32>> = x;
34    |                                 ^
35
36 error: aborting due to previous error
37