rust/tests/ui/lint/trivial_casts.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

165 lines
4.9 KiB
Plaintext
Raw Normal View History

2018-08-08 12:28:26 +00:00
error: trivial numeric cast: `i32` as `i32`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:16:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = 42_i32 as i32;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^^
|
2022-09-18 15:55:36 +00:00
= help: cast can be replaced by coercion; this might require a temporary variable
2020-01-22 23:57:38 +00:00
note: the lint level is defined here
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:4:24
2018-08-08 12:28:26 +00:00
|
LL | #![deny(trivial_casts, trivial_numeric_casts)]
| ^^^^^^^^^^^^^^^^^^^^^
error: trivial numeric cast: `u8` as `u8`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:19:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = 42_u8 as u8;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&u32` as `*const u32`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:24:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = x as *const u32;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^^^^
|
2022-09-18 15:55:36 +00:00
= help: cast can be replaced by coercion; this might require a temporary variable
2020-01-22 23:57:38 +00:00
note: the lint level is defined here
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:4:9
2018-08-08 12:28:26 +00:00
|
LL | #![deny(trivial_casts, trivial_numeric_casts)]
| ^^^^^^^^^^^^^
error: trivial cast: `&mut u32` as `*mut u32`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:28:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = x as *mut u32;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&[u32; 3]` as `&[u32]`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:33:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = x as &[u32];
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&[u32; 3]` as `*const [u32]`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:34:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = x as *const [u32];
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&mut [u32; 3]` as `&mut [u32]`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:39:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = x as &mut [u32];
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&mut [u32; 3]` as `*mut [u32]`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:40:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = x as *mut [u32];
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `Box<[u32; 3]>` as `Box<[u32]>`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:45:13
2018-08-08 12:28:26 +00:00
|
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`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:52:13
2018-08-08 12:28:26 +00:00
|
2019-05-28 18:46:13 +00:00
LL | let _ = x as &dyn Foo;
| ^^^^^^^^^^^^^
2018-08-08 12:28:26 +00:00
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&Bar` as `*const dyn Foo`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:53:13
2018-08-08 12:28:26 +00:00
|
2019-05-28 18:46:13 +00:00
LL | let _ = x as *const dyn Foo;
| ^^^^^^^^^^^^^^^^^^^
2018-08-08 12:28:26 +00:00
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&mut Bar` as `&mut dyn Foo`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:58:13
2018-08-08 12:28:26 +00:00
|
2019-05-28 18:46:13 +00:00
LL | let _ = x as &mut dyn Foo;
| ^^^^^^^^^^^^^^^^^
2018-08-08 12:28:26 +00:00
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&mut Bar` as `*mut dyn Foo`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:59:13
2018-08-08 12:28:26 +00:00
|
2019-05-28 18:46:13 +00:00
LL | let _ = x as *mut dyn Foo;
| ^^^^^^^^^^^^^^^^^
2018-08-08 12:28:26 +00:00
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `Box<Bar>` as `Box<dyn Foo>`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:64:13
2018-08-08 12:28:26 +00:00
|
2019-05-28 18:46:13 +00:00
LL | let _ = x as Box<dyn Foo>;
| ^^^^^^^^^^^^^^^^^
2018-08-08 12:28:26 +00:00
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&fn(i32) {baz}` as `&dyn Fn(i32)`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:70:13
2018-08-08 12:28:26 +00:00
|
2019-05-28 18:46:13 +00:00
LL | let _ = &baz as &dyn Fn(i32);
| ^^^^^^^^^^^^^^^^^^^^
2018-08-08 12:28:26 +00:00
|
= 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)`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:73:13
2018-08-08 12:28:26 +00:00
|
2019-05-28 18:46:13 +00:00
LL | let _ = &x as &dyn Fn(i32);
| ^^^^^^^^^^^^^^^^^^
2018-08-08 12:28:26 +00:00
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&'a Bar` as `&'a Bar`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:79:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = a as &'a Bar;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&'b Bar` as `&'a Bar`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:81:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = b as &'a Bar;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: trivial cast: `&'b Bar` as `&'b Bar`
2018-12-25 15:56:47 +00:00
--> $DIR/trivial_casts.rs:83:13
2018-08-08 12:28:26 +00:00
|
2019-03-09 12:03:44 +00:00
LL | let _ = b as &'b Bar;
2018-08-08 12:28:26 +00:00
| ^^^^^^^^^^^^
|
= help: cast can be replaced by coercion; this might require a temporary variable
error: aborting due to 19 previous errors