Skip to content

Commit cde0270

Browse files
committed
Update tests
1 parent dd22145 commit cde0270

6 files changed

Lines changed: 9 additions & 16 deletions

File tree

tests/unit/out/refcount/fn_ptr_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ pub fn add_offset_4(base: Ptr<i32>, offset: i32) -> i32 {
8888
pub fn test_call_through_cast_5() {
8989
let gfn: Value<FnPtr<fn(AnyPtr, i32) -> i32>> = Rc::new(RefCell::new(
9090
FnPtr::<fn(Ptr<i32>, i32) -> i32>::new(add_offset_4).cast::<fn(AnyPtr, i32) -> i32>(Some(
91-
(|a0: AnyPtr, a1: i32| -> i32 { add_offset_4(a0.cast::<i32>().unwrap(), a1) })
91+
(|a0: AnyPtr, a1: i32| -> i32 { add_offset_4(a0.reinterpret_cast::<i32>(), a1) })
9292
as fn(AnyPtr, i32) -> i32,
9393
)),
9494
));

tests/unit/out/refcount/fn_ptr_vtable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ pub fn int_create_1(val: i32) -> AnyPtr {
6262
}
6363
pub fn int_get_2(p: AnyPtr) -> i32 {
6464
let p: Value<AnyPtr> = Rc::new(RefCell::new(p));
65-
return ((*p.borrow()).cast::<i32>().expect("ub:wrong type").read());
65+
return ((*p.borrow()).reinterpret_cast::<i32>().read());
6666
}
6767
pub fn int_destroy_3(p: AnyPtr) {
6868
let p: Value<AnyPtr> = Rc::new(RefCell::new(p));
69-
(*p.borrow()).cast::<i32>().expect("ub:wrong type").write(0);
69+
(*p.borrow()).reinterpret_cast::<i32>().write(0);
7070
}
7171
pub fn main() {
7272
std::process::exit(main_0());

tests/unit/out/refcount/union_cross_arm_cast.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ fn main_0() -> i32 {
157157
(*(*(((*(*c.borrow()).u.borrow()).a())
158158
.clone()
159159
.to_any()
160-
.cast::<shape_b>()
161-
.expect("ub:wrong type"))
160+
.reinterpret_cast::<shape_b>())
162161
.upgrade()
163162
.deref())
164163
.tail

tests/unit/out/refcount/union_void_ptr_sized_deref.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,26 +106,23 @@ pub fn write_count_1(s: Ptr<Sink>, count: i64) {
106106
((*(*(*s.borrow()).upgrade().deref()).out.borrow())
107107
.handle()
108108
.read())
109-
.cast::<i64>()
110-
.expect("ub:wrong type")
109+
.reinterpret_cast::<i64>()
111110
.write((*count.borrow()));
112111
break 'switch;
113112
}
114113
__v if __v == ((Width_enum::W_32 as i32) as u32) => {
115114
((*(*(*s.borrow()).upgrade().deref()).out.borrow())
116115
.handle()
117116
.read())
118-
.cast::<i32>()
119-
.expect("ub:wrong type")
117+
.reinterpret_cast::<i32>()
120118
.write(((*count.borrow()) as i32));
121119
break 'switch;
122120
}
123121
__v if __v == ((Width_enum::W_16 as i32) as u32) => {
124122
((*(*(*s.borrow()).upgrade().deref()).out.borrow())
125123
.handle()
126124
.read())
127-
.cast::<i16>()
128-
.expect("ub:wrong type")
125+
.reinterpret_cast::<i16>()
129126
.write(((*count.borrow()) as i16));
130127
break 'switch;
131128
}

tests/unit/out/refcount/va_arg_non_primitive_ptrs.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,7 @@ fn main_0() -> i32 {
116116
(((({
117117
dispatch_0(
118118
(opt::OPT_FILE as i32),
119-
&[((AnyPtr::default())
120-
.cast::<::std::fs::File>()
121-
.expect("ub:wrong type"))
122-
.into()],
119+
&[((AnyPtr::default()).reinterpret_cast::<::std::fs::File>()).into()],
123120
)
124121
}) == 0) as i32)
125122
!= 0)

tests/unit/out/refcount/z_bit_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn main_0() -> i32 {
3030
_lhs == ((a1.as_pointer() as Ptr<u32>) as Ptr<u32>).to_any()
3131
});
3232
assert!({
33-
let _lhs = (((*ptr.borrow()).cast::<u32>().expect("ub:wrong type"))
33+
let _lhs = (((*ptr.borrow()).reinterpret_cast::<u32>())
3434
.offset((0) as isize)
3535
.read());
3636
_lhs == (*a1.borrow())[(0) as usize]

0 commit comments

Comments
 (0)