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