This commit is contained in:
bjorn3 2022-10-11 16:45:58 +02:00
commit 7bf4e19cc1
2 changed files with 16 additions and 2 deletions

View File

@ -635,7 +635,12 @@ fn codegen_stmt<'tcx>(
lval.write_cvalue(fx, operand.cast_pointer_to(to_layout)); lval.write_cvalue(fx, operand.cast_pointer_to(to_layout));
} }
Rvalue::Cast( Rvalue::Cast(
CastKind::Misc CastKind::IntToInt
| CastKind::FloatToFloat
| CastKind::FloatToInt
| CastKind::IntToFloat
| CastKind::FnPtrToPtr
| CastKind::PtrToPtr
| CastKind::PointerExposeAddress | CastKind::PointerExposeAddress
| CastKind::PointerFromExposedAddress, | CastKind::PointerFromExposedAddress,
ref operand, ref operand,

View File

@ -481,7 +481,16 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
match &stmt.kind { match &stmt.kind {
StatementKind::Assign(local_and_rvalue) if &local_and_rvalue.0 == place => { StatementKind::Assign(local_and_rvalue) if &local_and_rvalue.0 == place => {
match &local_and_rvalue.1 { match &local_and_rvalue.1 {
Rvalue::Cast(CastKind::Misc, operand, ty) => { Rvalue::Cast(
CastKind::IntToInt
| CastKind::FloatToFloat
| CastKind::FloatToInt
| CastKind::IntToFloat
| CastKind::FnPtrToPtr
| CastKind::PtrToPtr,
operand,
ty,
) => {
if computed_const_val.is_some() { if computed_const_val.is_some() {
return None; // local assigned twice return None; // local assigned twice
} }