diff --git a/tests/ui/types_fn_to_int.rs b/tests/ui/types_fn_to_int.rs index 0cce65798..927f2149f 100644 --- a/tests/ui/types_fn_to_int.rs +++ b/tests/ui/types_fn_to_int.rs @@ -10,6 +10,7 @@ fn bar() -> i32 { fn main() { let x = Foo::A; let y = x as i32; + let y1 = Foo::A as i32; let z = bar as u32; } diff --git a/tests/ui/types_fn_to_int.stderr b/tests/ui/types_fn_to_int.stderr index a3a1abcc6..064323047 100644 --- a/tests/ui/types_fn_to_int.stderr +++ b/tests/ui/types_fn_to_int.stderr @@ -6,11 +6,17 @@ error: casting a `fn(usize) -> Foo {Foo::A}` to `i32` may truncate the function | = note: #[deny(fn_to_numeric_cast)] on by default -error: casting a `fn() -> i32 {bar}` to `u32` may truncate the function address value. - --> $DIR/types_fn_to_int.rs:14:13 +error: casting a `fn(usize) -> Foo {Foo::A}` to `i32` may truncate the function address value. + --> $DIR/types_fn_to_int.rs:13:14 | -14 | let z = bar as u32; +13 | let y1 = Foo::A as i32; + | ^^^^^^^^^^^^^ help: if you need the address of the function, consider: `Foo::A as usize` + +error: casting a `fn() -> i32 {bar}` to `u32` may truncate the function address value. + --> $DIR/types_fn_to_int.rs:15:13 + | +15 | let z = bar as u32; | ^^^^^^^^^^ help: if you need the address of the function, consider: `bar as usize` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors