Skip to content

Commit 52b5868

Browse files
committed
Use underlying type of ptr_t for atomic ops
1 parent 3d0ed4a commit 52b5868

File tree

1 file changed

+13
-5
lines changed
  • library/panic_unwind/src

1 file changed

+13
-5
lines changed

library/panic_unwind/src/seh.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,10 @@ mod imp {
122122
pub const fn new(ptr: *mut u8) -> Self {
123123
Self(ptr)
124124
}
125+
126+
pub const fn raw(self) -> *mut u8 {
127+
self.0
128+
}
125129
}
126130
}
127131

@@ -157,6 +161,10 @@ mod imp {
157161
let offset: usize = addr - image_base;
158162
Self(offset as u32)
159163
}
164+
165+
pub const fn raw(self) -> u32 {
166+
self.0
167+
}
160168
}
161169
}
162170

@@ -319,23 +327,23 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
319327
// express more operations in statics (and we may never be able to).
320328
atomic_store_seqcst(
321329
addr_of_mut!(THROW_INFO.pmfnUnwind).cast(),
322-
ptr_t::new(exception_cleanup as *mut u8),
330+
ptr_t::new(exception_cleanup as *mut u8).raw(),
323331
);
324332
atomic_store_seqcst(
325333
addr_of_mut!(THROW_INFO.pCatchableTypeArray).cast(),
326-
ptr_t::new(addr_of_mut!(CATCHABLE_TYPE_ARRAY).cast()),
334+
ptr_t::new(addr_of_mut!(CATCHABLE_TYPE_ARRAY).cast()).raw(),
327335
);
328336
atomic_store_seqcst(
329337
addr_of_mut!(CATCHABLE_TYPE_ARRAY.arrayOfCatchableTypes[0]).cast(),
330-
ptr_t::new(addr_of_mut!(CATCHABLE_TYPE).cast()),
338+
ptr_t::new(addr_of_mut!(CATCHABLE_TYPE).cast()).raw(),
331339
);
332340
atomic_store_seqcst(
333341
addr_of_mut!(CATCHABLE_TYPE.pType).cast(),
334-
ptr_t::new(addr_of_mut!(TYPE_DESCRIPTOR).cast()),
342+
ptr_t::new(addr_of_mut!(TYPE_DESCRIPTOR).cast()).raw(),
335343
);
336344
atomic_store_seqcst(
337345
addr_of_mut!(CATCHABLE_TYPE.copyFunction).cast(),
338-
ptr_t::new(exception_copy as *mut u8),
346+
ptr_t::new(exception_copy as *mut u8).raw(),
339347
);
340348

341349
extern "system-unwind" {

0 commit comments

Comments
 (0)