]> git.lizzy.rs Git - rust.git/blob - src/test/ui/error-codes/E0490.stderr
Merge commit '370c397ec9169809e5ad270079712e0043514240' into sync_cg_clif-2022-03-20
[rust.git] / src / test / ui / error-codes / E0490.stderr
1 error[E0490]: a value of type `&'b ()` is borrowed for too long
2   --> $DIR/E0490.rs:2:20
3    |
4 LL |     let x: &'a _ = &y;
5    |                    ^^
6    |
7 note: the type is valid for the lifetime `'a` as defined here
8   --> $DIR/E0490.rs:1:6
9    |
10 LL | fn f<'a, 'b>(y: &'b ()) {
11    |      ^^
12 note: but the borrow lasts for the lifetime `'b` as defined here
13   --> $DIR/E0490.rs:1:10
14    |
15 LL | fn f<'a, 'b>(y: &'b ()) {
16    |          ^^
17
18 error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
19   --> $DIR/E0490.rs:2:20
20    |
21 LL |     let x: &'a _ = &y;
22    |                    ^^
23    |
24 note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
25   --> $DIR/E0490.rs:1:10
26    |
27 LL | fn f<'a, 'b>(y: &'b ()) {
28    |          ^^
29 note: ...so that the type `&'b ()` is not borrowed for too long
30   --> $DIR/E0490.rs:2:20
31    |
32 LL |     let x: &'a _ = &y;
33    |                    ^^
34 note: but, the lifetime must be valid for the lifetime `'a` as defined here...
35   --> $DIR/E0490.rs:1:6
36    |
37 LL | fn f<'a, 'b>(y: &'b ()) {
38    |      ^^
39 note: ...so that reference does not outlive borrowed content
40   --> $DIR/E0490.rs:2:20
41    |
42 LL |     let x: &'a _ = &y;
43    |                    ^^
44
45 error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
46   --> $DIR/E0490.rs:2:20
47    |
48 LL |     let x: &'a _ = &y;
49    |                    ^^
50    |
51 note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
52   --> $DIR/E0490.rs:1:10
53    |
54 LL | fn f<'a, 'b>(y: &'b ()) {
55    |          ^^
56 note: ...so that the expression is assignable
57   --> $DIR/E0490.rs:2:20
58    |
59 LL |     let x: &'a _ = &y;
60    |                    ^^
61    = note: expected `&'a &()`
62               found `&'a &'b ()`
63 note: but, the lifetime must be valid for the lifetime `'a` as defined here...
64   --> $DIR/E0490.rs:1:6
65    |
66 LL | fn f<'a, 'b>(y: &'b ()) {
67    |      ^^
68 note: ...so that the reference type `&'a &()` does not outlive the data it points at
69   --> $DIR/E0490.rs:2:12
70    |
71 LL |     let x: &'a _ = &y;
72    |            ^^^^^
73
74 error: aborting due to 3 previous errors
75
76 For more information about this error, try `rustc --explain E0495`.