Skip to content

Commit 7229e1b

Browse files
committed
c2rust-refactor: Fix type mismatch in casts tests
1 parent fce6cd0 commit 7229e1b

File tree

1 file changed

+4
-5
lines changed
  • c2rust-refactor/src/transform/casts

1 file changed

+4
-5
lines changed

c2rust-refactor/src/transform/casts/tests.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@ impl Arbitrary for SimpleTy {
3333
}
3434

3535
fn ty_bit_width(ty: SimpleTy, pw: PointerWidth) -> u32 {
36-
let bw = match ty {
37-
SimpleTy::Int(w, _) => w,
38-
SimpleTy::Size(_) | SimpleTy::Pointer => pw.0,
36+
match ty {
37+
SimpleTy::Int(w, _) => w.try_into().expect("failed to cast"),
38+
SimpleTy::Size(_) | SimpleTy::Pointer => pw.0.try_into().expect("failed to cast"),
3939
SimpleTy::Float32 => 32,
4040
SimpleTy::Float64 => 64,
4141
SimpleTy::Other => unreachable!(), // FIXME
42-
};
43-
bw as u32
42+
}
4443
}
4544

4645
fn cast_bv<'bv>(bv: BV<'bv>, from_ty: SimpleTy, to_ty: SimpleTy, pw: PointerWidth) -> BV<'bv> {

0 commit comments

Comments
 (0)