summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/trivial_casts.stderr
blob: 74f962835c255bf4b1b3aeca5631aa8f18341ee6 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
error: trivial numeric cast: `i32` as `i32`
  --> $DIR/trivial_casts.rs:16:13
   |
LL |     let _ = 42_i32 as i32;
   |             ^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable
note: the lint level is defined here
  --> $DIR/trivial_casts.rs:4:24
   |
LL | #![deny(trivial_casts, trivial_numeric_casts)]
   |                        ^^^^^^^^^^^^^^^^^^^^^

error: trivial numeric cast: `u8` as `u8`
  --> $DIR/trivial_casts.rs:19:13
   |
LL |     let _ = 42_u8 as u8;
   |             ^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&u32` as `*const u32`
  --> $DIR/trivial_casts.rs:24:13
   |
LL |     let _ = x as *const u32;
   |             ^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable
note: the lint level is defined here
  --> $DIR/trivial_casts.rs:4:9
   |
LL | #![deny(trivial_casts, trivial_numeric_casts)]
   |         ^^^^^^^^^^^^^

error: trivial cast: `&mut u32` as `*mut u32`
  --> $DIR/trivial_casts.rs:28:13
   |
LL |     let _ = x as *mut u32;
   |             ^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&[u32; 3]` as `&[u32]`
  --> $DIR/trivial_casts.rs:33:13
   |
LL |     let _ = x as &[u32];
   |             ^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&[u32; 3]` as `*const [u32]`
  --> $DIR/trivial_casts.rs:34:13
   |
LL |     let _ = x as *const [u32];
   |             ^^^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&mut [u32; 3]` as `&mut [u32]`
  --> $DIR/trivial_casts.rs:39:13
   |
LL |     let _ = x as &mut [u32];
   |             ^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&mut [u32; 3]` as `*mut [u32]`
  --> $DIR/trivial_casts.rs:40:13
   |
LL |     let _ = x as *mut [u32];
   |             ^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `Box<[u32; 3]>` as `Box<[u32]>`
  --> $DIR/trivial_casts.rs:45:13
   |
LL |     let _ = x as Box<[u32]>;
   |             ^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&Bar` as `&dyn Foo`
  --> $DIR/trivial_casts.rs:52:13
   |
LL |     let _ = x as &dyn Foo;
   |             ^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&Bar` as `*const dyn Foo`
  --> $DIR/trivial_casts.rs:53:13
   |
LL |     let _ = x as *const dyn Foo;
   |             ^^^^^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&mut Bar` as `&mut dyn Foo`
  --> $DIR/trivial_casts.rs:58:13
   |
LL |     let _ = x as &mut dyn Foo;
   |             ^^^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&mut Bar` as `*mut dyn Foo`
  --> $DIR/trivial_casts.rs:59:13
   |
LL |     let _ = x as *mut dyn Foo;
   |             ^^^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `Box<Bar>` as `Box<dyn Foo>`
  --> $DIR/trivial_casts.rs:64:13
   |
LL |     let _ = x as Box<dyn Foo>;
   |             ^^^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&fn(i32) {baz}` as `&dyn Fn(i32)`
  --> $DIR/trivial_casts.rs:70:13
   |
LL |     let _ = &baz as &dyn Fn(i32);
   |             ^^^^^^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&[closure@$DIR/trivial_casts.rs:72:13: 72:22]` as `&dyn Fn(i32)`
  --> $DIR/trivial_casts.rs:73:13
   |
LL |     let _ = &x as &dyn Fn(i32);
   |             ^^^^^^^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&'a Bar` as `&'a Bar`
  --> $DIR/trivial_casts.rs:79:13
   |
LL |     let _ = a as &'a Bar;
   |             ^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&'b Bar` as `&'a Bar`
  --> $DIR/trivial_casts.rs:81:13
   |
LL |     let _ = b as &'a Bar;
   |             ^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: trivial cast: `&'b Bar` as `&'b Bar`
  --> $DIR/trivial_casts.rs:83:13
   |
LL |     let _ = b as &'b Bar;
   |             ^^^^^^^^^^^^
   |
   = help: cast can be replaced by coercion; this might require a temporary variable

error: aborting due to 19 previous errors