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