mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
remove some UB
This commit is contained in:
parent
92c2931678
commit
f63460eb69
2 changed files with 2 additions and 1 deletions
|
@ -18,6 +18,7 @@ pub extern "C" fn rust_main() -> i32 {
|
|||
// Verify that it has all the expected traits.
|
||||
|
||||
assert!(tag_union == tag_union); // PartialEq
|
||||
|
||||
assert!(tag_union.clone() == tag_union.clone()); // Clone
|
||||
|
||||
assert!(tag_union.partial_cmp(&tag_union) == Some(Ordering::Equal)); // PartialOrd
|
||||
|
|
|
@ -33,7 +33,7 @@ impl<T> RocBox<T> {
|
|||
let contents = unsafe {
|
||||
let contents_ptr = ptr.cast::<u8>().add(alignment).cast::<T>();
|
||||
|
||||
*contents_ptr = contents;
|
||||
core::ptr::write(contents_ptr, contents);
|
||||
|
||||
// We already verified that the original alloc pointer was non-null,
|
||||
// and this one is the alloc pointer with `alignment` bytes added to it,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue