fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.3 KiB68 linesraw
1warning: lifetime parameter `'b` never used
2  --> $DIR/regions-static-bound.rs:3:17
3   |
4LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t }
5   |                -^^
6   |                |
7   |                help: elide the unused lifetime
8   |
9note: the lint level is defined here
10  --> $DIR/regions-static-bound.rs:1:9
11   |
12LL | #![warn(unused_lifetimes)]
13   |         ^^^^^^^^^^^^^^^^
14
15warning: unnecessary lifetime parameter `'a`
16  --> $DIR/regions-static-bound.rs:3:53
17   |
18LL | fn static_id<'a,'b>(t: &'a ()) -> &'static () where 'a: 'static { t }
19   |                                                     ^^
20   |
21   = help: you can use the `'static` lifetime directly, in place of `'a`
22
23warning: unnecessary lifetime parameter `'b`
24  --> $DIR/regions-static-bound.rs:8:19
25   |
26LL |     where 'a: 'b, 'b: 'static { t }
27   |                   ^^
28   |
29   = help: you can use the `'static` lifetime directly, in place of `'b`
30
31error: lifetime may not live long enough
32  --> $DIR/regions-static-bound.rs:12:5
33   |
34LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
35   |                        -- lifetime `'a` defined here
36LL |     t
37   |     ^ returning this value requires that `'a` must outlive `'static`
38
39error[E0521]: borrowed data escapes outside of function
40  --> $DIR/regions-static-bound.rs:17:5
41   |
42LL | fn error(u: &(), v: &()) {
43   |          -  - let's call the lifetime of this reference `'1`
44   |          |
45   |          `u` is a reference that is only valid in the function body
46LL |     static_id(&u);
47   |     ^^^^^^^^^^^^^
48   |     |
49   |     `u` escapes the function body here
50   |     argument requires that `'1` must outlive `'static`
51
52error[E0521]: borrowed data escapes outside of function
53  --> $DIR/regions-static-bound.rs:19:5
54   |
55LL | fn error(u: &(), v: &()) {
56   |                  -  - let's call the lifetime of this reference `'2`
57   |                  |
58   |                  `v` is a reference that is only valid in the function body
59...
60LL |     static_id_indirect(&v);
61   |     ^^^^^^^^^^^^^^^^^^^^^^
62   |     |
63   |     `v` escapes the function body here
64   |     argument requires that `'2` must outlive `'static`
65
66error: aborting due to 3 previous errors; 3 warnings emitted
67
68For more information about this error, try `rustc --explain E0521`.