about summary refs log tree commit diff
path: root/tests/ui/transmutability/references/reject_lifetime_extension.stderr
blob: b97029841453f06da6357c91b4753eddb4180036 (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
77
78
error: lifetime may not live long enough
  --> $DIR/reject_lifetime_extension.rs:20:18
   |
LL |     fn extend_bare<'a>(src: &'a u8) -> &'static u8 {
   |                    -- lifetime `'a` defined here
LL |         unsafe { transmute(src) }
   |                  ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/reject_lifetime_extension.rs:28:18
   |
LL |     fn extend_nested<'a>(src: &'a &'a u8) -> &'a &'static u8 {
   |                      -- lifetime `'a` defined here
LL |         unsafe { transmute(src) }
   |                  ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/reject_lifetime_extension.rs:36:18
   |
LL |     fn extend_unit<'a>(src: (&'a u8,)) -> (&'static u8,) {
   |                    -- lifetime `'a` defined here
LL |         unsafe { transmute(src) }
   |                  ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/reject_lifetime_extension.rs:40:18
   |
LL |     fn extend_pair<'a>(src: (&'a u8, u8)) -> (&'static u8, u8) {
   |                    -- lifetime `'a` defined here
LL |         unsafe { transmute(src) }
   |                  ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/reject_lifetime_extension.rs:50:18
   |
LL |     fn extend_struct<'a>(src: Struct<'a>) -> Struct<'static> {
   |                      -- lifetime `'a` defined here
LL |         unsafe { transmute(src) }
   |                  ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/reject_lifetime_extension.rs:62:18
   |
LL |     fn extend_single<'a>(src: Single<'a>) -> Single<'static> {
   |                      -- lifetime `'a` defined here
LL |         unsafe { transmute(src) }
   |                  ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error: lifetime may not live long enough
  --> $DIR/reject_lifetime_extension.rs:72:18
   |
LL |     fn extend_multi<'a>(src: Multi<'a>) -> Multi<'static> {
   |                     -- lifetime `'a` defined here
LL |         unsafe { transmute(src) }
   |                  ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`

error[E0521]: borrowed data escapes outside of function
  --> $DIR/reject_lifetime_extension.rs:80:18
   |
LL |     fn call_extend_hrtb<'a>(src: &'a u8) -> &'static u8 {
   |                         --  --- `src` is a reference that is only valid in the function body
   |                         |
   |                         lifetime `'a` defined here
LL |         unsafe { extend_hrtb(src) }
   |                  ^^^^^^^^^^^^^^^^
   |                  |
   |                  `src` escapes the function body here
   |                  argument requires that `'a` must outlive `'static`
   |
note: due to a current limitation of the type system, this implies a `'static` lifetime
  --> $DIR/reject_lifetime_extension.rs:85:9
   |
LL |         for<'b> &'b u8: TransmuteFrom<&'a u8>,
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 8 previous errors

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