Disallow casting directly between C-like enums and unsafe pointers
This closes issue #17444
This commit is contained in:
parent
293b57701b
commit
7c9db32f82
1 changed files with 1 additions and 1 deletions
|
|
@ -1468,7 +1468,7 @@ fn check_cast(fcx: &FnCtxt,
|
|||
// casts to scalars other than `char` and `bare fn` are trivial
|
||||
let t_1_is_trivial = t_1_is_scalar && !t_1_is_char && !t_1_is_bare_fn;
|
||||
if ty::type_is_c_like_enum(fcx.tcx(), t_e) && t_1_is_trivial {
|
||||
if t_1_is_float {
|
||||
if t_1_is_float || ty::type_is_unsafe_ptr(t_1) {
|
||||
fcx.type_error_message(span, |actual| {
|
||||
format!("illegal cast; cast through an \
|
||||
integer first: `{}` as `{}`",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue