We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 293b577 commit 7c9db32Copy full SHA for 7c9db32
src/librustc/middle/typeck/check/mod.rs
@@ -1468,7 +1468,7 @@ fn check_cast(fcx: &FnCtxt,
1468
// casts to scalars other than `char` and `bare fn` are trivial
1469
let t_1_is_trivial = t_1_is_scalar && !t_1_is_char && !t_1_is_bare_fn;
1470
if ty::type_is_c_like_enum(fcx.tcx(), t_e) && t_1_is_trivial {
1471
- if t_1_is_float {
+ if t_1_is_float || ty::type_is_unsafe_ptr(t_1) {
1472
fcx.type_error_message(span, |actual| {
1473
format!("illegal cast; cast through an \
1474
integer first: `{}` as `{}`",
0 commit comments