]> git.lizzy.rs Git - rust.git/blob - src/test/ui/trivial_casts.stderr
Rollup merge of #53317 - estebank:abolish-ice, r=oli-obk
[rust.git] / src / test / ui / trivial_casts.stderr
1 error: trivial numeric cast: `i32` as `i32`
2   --> $DIR/trivial_casts.rs:26:13
3    |
4 LL |     let _ = 42_i32 as i32; //~ ERROR trivial numeric cast: `i32` as `i32`
5    |             ^^^^^^^^^^^^^
6    |
7 note: lint level defined here
8   --> $DIR/trivial_casts.rs:14:24
9    |
10 LL | #![deny(trivial_casts, trivial_numeric_casts)]
11    |                        ^^^^^^^^^^^^^^^^^^^^^
12    = help: cast can be replaced by coercion; this might require a temporary variable
13
14 error: trivial numeric cast: `u8` as `u8`
15   --> $DIR/trivial_casts.rs:29:13
16    |
17 LL |     let _ = 42_u8 as u8; //~ ERROR trivial numeric cast: `u8` as `u8`
18    |             ^^^^^^^^^^^
19    |
20    = help: cast can be replaced by coercion; this might require a temporary variable
21
22 error: trivial cast: `&u32` as `*const u32`
23   --> $DIR/trivial_casts.rs:34:13
24    |
25 LL |     let _ = x as *const u32; //~ERROR trivial cast: `&u32` as `*const u32`
26    |             ^^^^^^^^^^^^^^^
27    |
28 note: lint level defined here
29   --> $DIR/trivial_casts.rs:14:9
30    |
31 LL | #![deny(trivial_casts, trivial_numeric_casts)]
32    |         ^^^^^^^^^^^^^
33    = help: cast can be replaced by coercion; this might require a temporary variable
34
35 error: trivial cast: `&mut u32` as `*mut u32`
36   --> $DIR/trivial_casts.rs:38:13
37    |
38 LL |     let _ = x as *mut u32; //~ERROR trivial cast: `&mut u32` as `*mut u32`
39    |             ^^^^^^^^^^^^^
40    |
41    = help: cast can be replaced by coercion; this might require a temporary variable
42
43 error: trivial cast: `&[u32; 3]` as `&[u32]`
44   --> $DIR/trivial_casts.rs:43:13
45    |
46 LL |     let _ = x as &[u32]; //~ERROR trivial cast: `&[u32; 3]` as `&[u32]`
47    |             ^^^^^^^^^^^
48    |
49    = help: cast can be replaced by coercion; this might require a temporary variable
50
51 error: trivial cast: `&[u32; 3]` as `*const [u32]`
52   --> $DIR/trivial_casts.rs:44:13
53    |
54 LL |     let _ = x as *const [u32]; //~ERROR trivial cast: `&[u32; 3]` as `*const [u32]`
55    |             ^^^^^^^^^^^^^^^^^
56    |
57    = help: cast can be replaced by coercion; this might require a temporary variable
58
59 error: trivial cast: `&mut [u32; 3]` as `&mut [u32]`
60   --> $DIR/trivial_casts.rs:49:13
61    |
62 LL |     let _ = x as &mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `&mut [u32]`
63    |             ^^^^^^^^^^^^^^^
64    |
65    = help: cast can be replaced by coercion; this might require a temporary variable
66
67 error: trivial cast: `&mut [u32; 3]` as `*mut [u32]`
68   --> $DIR/trivial_casts.rs:50:13
69    |
70 LL |     let _ = x as *mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `*mut [u32]`
71    |             ^^^^^^^^^^^^^^^
72    |
73    = help: cast can be replaced by coercion; this might require a temporary variable
74
75 error: trivial cast: `std::boxed::Box<[u32; 3]>` as `std::boxed::Box<[u32]>`
76   --> $DIR/trivial_casts.rs:55:13
77    |
78 LL |     let _ = x as Box<[u32]>;
79    |             ^^^^^^^^^^^^^^^
80    |
81    = help: cast can be replaced by coercion; this might require a temporary variable
82
83 error: trivial cast: `&Bar` as `&dyn Foo`
84   --> $DIR/trivial_casts.rs:62:13
85    |
86 LL |     let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo`
87    |             ^^^^^^^^^
88    |
89    = help: cast can be replaced by coercion; this might require a temporary variable
90
91 error: trivial cast: `&Bar` as `*const dyn Foo`
92   --> $DIR/trivial_casts.rs:63:13
93    |
94 LL |     let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo`
95    |             ^^^^^^^^^^^^^^^
96    |
97    = help: cast can be replaced by coercion; this might require a temporary variable
98
99 error: trivial cast: `&mut Bar` as `&mut dyn Foo`
100   --> $DIR/trivial_casts.rs:68:13
101    |
102 LL |     let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo`
103    |             ^^^^^^^^^^^^^
104    |
105    = help: cast can be replaced by coercion; this might require a temporary variable
106
107 error: trivial cast: `&mut Bar` as `*mut dyn Foo`
108   --> $DIR/trivial_casts.rs:69:13
109    |
110 LL |     let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo`
111    |             ^^^^^^^^^^^^^
112    |
113    = help: cast can be replaced by coercion; this might require a temporary variable
114
115 error: trivial cast: `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
116   --> $DIR/trivial_casts.rs:74:13
117    |
118 LL |     let _ = x as Box<Foo>; //~ERROR `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
119    |             ^^^^^^^^^^^^^
120    |
121    = help: cast can be replaced by coercion; this might require a temporary variable
122
123 error: trivial cast: `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
124   --> $DIR/trivial_casts.rs:80:13
125    |
126 LL |     let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
127    |             ^^^^^^^^^^^^^^^^
128    |
129    = help: cast can be replaced by coercion; this might require a temporary variable
130
131 error: trivial cast: `&[closure@$DIR/trivial_casts.rs:82:13: 82:25]` as `&dyn std::ops::Fn(i32)`
132   --> $DIR/trivial_casts.rs:83:13
133    |
134 LL |     let _ = &x as &Fn(i32); //~ERROR trivial cast
135    |             ^^^^^^^^^^^^^^
136    |
137    = help: cast can be replaced by coercion; this might require a temporary variable
138
139 error: trivial cast: `&'a Bar` as `&'a Bar`
140   --> $DIR/trivial_casts.rs:89:13
141    |
142 LL |     let _ = a as &'a Bar; //~ERROR trivial cast
143    |             ^^^^^^^^^^^^
144    |
145    = help: cast can be replaced by coercion; this might require a temporary variable
146
147 error: trivial cast: `&'b Bar` as `&'a Bar`
148   --> $DIR/trivial_casts.rs:91:13
149    |
150 LL |     let _ = b as &'a Bar; //~ERROR trivial cast
151    |             ^^^^^^^^^^^^
152    |
153    = help: cast can be replaced by coercion; this might require a temporary variable
154
155 error: trivial cast: `&'b Bar` as `&'b Bar`
156   --> $DIR/trivial_casts.rs:93:13
157    |
158 LL |     let _ = b as &'b Bar; //~ERROR trivial cast
159    |             ^^^^^^^^^^^^
160    |
161    = help: cast can be replaced by coercion; this might require a temporary variable
162
163 error: aborting due to 19 previous errors
164