Skip to content

Commit 4159922

Browse files
committed
refactor: casts: remove inner casts only if all signednesses match
this fixes the i32 -> u32 -> isize test case
1 parent b623a61 commit 4159922

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

c2rust-refactor/src/transform/casts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ fn check_double_cast<'tcx>(e_ty: SimpleTy, t1_ty: SimpleTy, t2_ty: SimpleTy) ->
166166
| (SameWidth, Extend(s))
167167
| (SameWidth, FromPointer(s))
168168
| (SameWidth, ToPointer(s))
169-
if s == e_ty.is_signed() =>
169+
if s == e_ty.is_signed() && s == t1_ty.is_signed() =>
170170
{
171171
DoubleCastAction::RemoveInner
172172
}

0 commit comments

Comments
 (0)