rust/src/test/ui/trivial_casts.stderr

165 lines
5.7 KiB
Plaintext

error: trivial numeric cast: `i32` as `i32`
--> $DIR/trivial_casts.rs:26:13
|
LL | let _ = 42_i32 as i32; //~ ERROR trivial numeric cast: `i32` as `i32`
| ^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/trivial_casts.rs:14:24
|
LL | #![deny(trivial_casts, trivial_numeric_casts)]
| ^^^^^^^^^^^^^^^^^^^^^
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial numeric cast: `u8` as `u8`
--> $DIR/trivial_casts.rs:29:13
|
LL | let _ = 42_u8 as u8; //~ ERROR trivial numeric cast: `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:34:13
|
LL | let _ = x as *const u32; //~ERROR trivial cast: `&u32` as `*const u32`
| ^^^^^^^^^^^^^^^
|
note: lint level defined here
--> $DIR/trivial_casts.rs:14:9
|
LL | #![deny(trivial_casts, trivial_numeric_casts)]
| ^^^^^^^^^^^^^
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&mut u32` as `*mut u32`
--> $DIR/trivial_casts.rs:38:13
|
LL | let _ = x as *mut u32; //~ERROR trivial cast: `&mut u32` 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:43:13
|
LL | let _ = x as &[u32]; //~ERROR trivial cast: `&[u32; 3]` 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:44:13
|
LL | let _ = x as *const [u32]; //~ERROR trivial cast: `&[u32; 3]` 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:49:13
|
LL | let _ = x as &mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` 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:50:13
|
LL | let _ = x as *mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `*mut [u32]`
| ^^^^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `std::boxed::Box<[u32; 3]>` as `std::boxed::Box<[u32]>`
--> $DIR/trivial_casts.rs:55: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:62:13
|
LL | let _ = x as &Foo; //~ERROR trivial cast: `&Bar` 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:63:13
|
LL | let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` 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:68:13
|
LL | let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` 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:69:13
|
LL | let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo`
| ^^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
--> $DIR/trivial_casts.rs:74:13
|
LL | let _ = x as Box<Foo>; //~ERROR `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
| ^^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
--> $DIR/trivial_casts.rs:80:13
|
LL | let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
| ^^^^^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&[closure@$DIR/trivial_casts.rs:82:13: 82:25]` as `&dyn std::ops::Fn(i32)`
--> $DIR/trivial_casts.rs:83:13
|
LL | let _ = &x as &Fn(i32); //~ERROR trivial cast
| ^^^^^^^^^^^^^^
|
= 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:89:13
|
LL | let _ = a as &'a Bar; //~ERROR trivial cast
| ^^^^^^^^^^^^
|
= 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:91:13
|
LL | let _ = b as &'a Bar; //~ERROR trivial cast
| ^^^^^^^^^^^^
|
= 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:93:13
|
LL | let _ = b as &'b Bar; //~ERROR trivial cast
| ^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: aborting due to 19 previous errors