about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/transmute.stderr
blob: 79528ec06f1bf60e6c2fb73409fa154adb87a3c8 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
error: transmute from a reference to a pointer
  --> tests/ui/transmute.rs:33:27
   |
LL |         let _: *const T = core::mem::transmute(t);
   |                           ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T`
   |
   = note: `-D clippy::useless-transmute` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::useless_transmute)]`

error: transmute from a reference to a pointer
  --> tests/ui/transmute.rs:36:25
   |
LL |         let _: *mut T = core::mem::transmute(t);
   |                         ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *mut T`

error: transmute from a reference to a pointer
  --> tests/ui/transmute.rs:39:27
   |
LL |         let _: *const U = core::mem::transmute(t);
   |                           ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `t as *const T as *const U`

error: transmute from a type (`std::vec::Vec<i32>`) to itself
  --> tests/ui/transmute.rs:47:27
   |
LL |         let _: Vec<i32> = core::mem::transmute(my_vec());
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: transmute from a type (`std::vec::Vec<i32>`) to itself
  --> tests/ui/transmute.rs:50:27
   |
LL |         let _: Vec<i32> = core::mem::transmute(my_vec());
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: transmute from a type (`std::vec::Vec<i32>`) to itself
  --> tests/ui/transmute.rs:53:27
   |
LL |         let _: Vec<i32> = std::mem::transmute(my_vec());
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: transmute from a type (`std::vec::Vec<i32>`) to itself
  --> tests/ui/transmute.rs:56:27
   |
LL |         let _: Vec<i32> = std::mem::transmute(my_vec());
   |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: transmute from a type (`std::vec::Vec<i32>`) to itself
  --> tests/ui/transmute.rs:59:27
   |
LL |         let _: Vec<i32> = my_transmute(my_vec());
   |                           ^^^^^^^^^^^^^^^^^^^^^^

error: transmute from an integer to a pointer
  --> tests/ui/transmute.rs:62:31
   |
LL |         let _: *const usize = std::mem::transmute(5_isize);
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `5_isize as *const usize`

error: transmute from an integer to a pointer
  --> tests/ui/transmute.rs:67:31
   |
LL |         let _: *const usize = std::mem::transmute(1 + 1usize);
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(1 + 1usize) as *const usize`

error: transmute from a type (`*const Usize`) to the type that it points to (`Usize`)
  --> tests/ui/transmute.rs:99:24
   |
LL |         let _: Usize = core::mem::transmute(int_const_ptr);
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::crosspointer-transmute` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::crosspointer_transmute)]`

error: transmute from a type (`*mut Usize`) to the type that it points to (`Usize`)
  --> tests/ui/transmute.rs:102:24
   |
LL |         let _: Usize = core::mem::transmute(int_mut_ptr);
   |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: transmute from a type (`Usize`) to a pointer to that type (`*const Usize`)
  --> tests/ui/transmute.rs:105:31
   |
LL |         let _: *const Usize = core::mem::transmute(my_int());
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: transmute from a type (`Usize`) to a pointer to that type (`*mut Usize`)
  --> tests/ui/transmute.rs:108:29
   |
LL |         let _: *mut Usize = core::mem::transmute(my_int());
   |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: transmute from a `u8` to a `bool`
  --> tests/ui/transmute.rs:115:28
   |
LL |     let _: bool = unsafe { std::mem::transmute(0_u8) };
   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `0_u8 != 0`
   |
   = note: `-D clippy::transmute-int-to-bool` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::transmute_int_to_bool)]`

error: transmute from a `&[u8]` to a `&str`
  --> tests/ui/transmute.rs:122:28
   |
LL |     let _: &str = unsafe { std::mem::transmute(B) };
   |                            ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8(B).unwrap()`
   |
   = note: `-D clippy::transmute-bytes-to-str` implied by `-D warnings`
   = help: to override `-D warnings` add `#[allow(clippy::transmute_bytes_to_str)]`

error: transmute from a `&mut [u8]` to a `&mut str`
  --> tests/ui/transmute.rs:125:32
   |
LL |     let _: &mut str = unsafe { std::mem::transmute(mb) };
   |                                ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_mut(mb).unwrap()`

error: transmute from a `&[u8]` to a `&str`
  --> tests/ui/transmute.rs:128:30
   |
LL |     const _: &str = unsafe { std::mem::transmute(B) };
   |                              ^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `std::str::from_utf8_unchecked(B)`

error: aborting due to 18 previous errors