summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/regions-static-bound.stderr
blob: b314e9fe85d4e547c55923a1385a56020bbe8f91 (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
warning: lifetime parameter `'b` never used
  --> $DIR/regions-static-bound.rs:3:17
   |
LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t }
   |                -^^
   |                |
   |                help: elide the unused lifetime
   |
note: the lint level is defined here
  --> $DIR/regions-static-bound.rs:1:9
   |
LL | #![warn(unused_lifetimes)]
   |         ^^^^^^^^^^^^^^^^

warning: unnecessary lifetime parameter `'a`
  --> $DIR/regions-static-bound.rs:3:53
   |
LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t }
   |                                                     ^^
   |
   = help: you can use the `'static` lifetime directly, in place of `'a`

warning: unnecessary lifetime parameter `'b`
  --> $DIR/regions-static-bound.rs:8:19
   |
LL |     where 'a: 'b, 'b: 'static { t }
   |                   ^^
   |
   = help: you can use the `'static` lifetime directly, in place of `'b`

error: lifetime may not live long enough
  --> $DIR/regions-static-bound.rs:12:5
   |
LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
   |                        -- lifetime `'a` defined here
LL |     t
   |     ^ returning this value requires that `'a` must outlive `'static`

error[E0521]: borrowed data escapes outside of function
  --> $DIR/regions-static-bound.rs:17:5
   |
LL | fn error(u: &(), v: &()) {
   |          -  - let's call the lifetime of this reference `'1`
   |          |
   |          `u` is a reference that is only valid in the function body
LL |     static_id(&u);
   |     ^^^^^^^^^^^^^
   |     |
   |     `u` escapes the function body here
   |     argument requires that `'1` must outlive `'static`

error[E0521]: borrowed data escapes outside of function
  --> $DIR/regions-static-bound.rs:19:5
   |
LL | fn error(u: &(), v: &()) {
   |                  -  - let's call the lifetime of this reference `'2`
   |                  |
   |                  `v` is a reference that is only valid in the function body
...
LL |     static_id_indirect(&v);
   |     ^^^^^^^^^^^^^^^^^^^^^^
   |     |
   |     `v` escapes the function body here
   |     argument requires that `'2` must outlive `'static`

error: aborting due to 3 previous errors; 3 warnings emitted

For more information about this error, try `rustc --explain E0521`.