weird thing

This commit is contained in:
Victor Korkin 2018-05-30 07:55:48 +07:00
parent f6e0388e08
commit e4b2a97401
2 changed files with 12 additions and 2 deletions

View file

@ -1002,8 +1002,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CastPass {
cx,
FN_TO_NUMERIC_CAST,
expr.span,
&format!("casting a Fn to {} may truncate the function address value.", cast_to),
"if you need address of function, use cast to `usize` instead:",
&format!("casting a `{}` to `{}` may truncate the function address value.", cast_from, cast_to),
// &format!("if you need address of function, use cast zz `usize`:"),
&format!("if you need the address of the function, z consider:"),
format!("{} as usize", &snippet(cx, ex.span, "x"))
);
}

View file

@ -3,7 +3,16 @@ enum Foo {
B
}
fn bar() -> i32 {
0i32
}
fn main() {
let x = Foo::A;
let y = x as i32;
let z = bar as u32;
//let c = || {0i32};
//let ac = c as u32;
}