Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Oct 4, 2021
1 parent 26f5e0a commit 9db832d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions utils/zerovec/src/ule/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod vec;
pub use chars::CharULE;
pub use plain::PlainOldULE;

use alloc::alloc::Layout;
use alloc::borrow::ToOwned;
use alloc::boxed::Box;
use core::{fmt, mem, slice};
Expand Down Expand Up @@ -311,6 +312,7 @@ pub unsafe trait VarULE: 'static {
// Get the pointer representation
let ptr: *mut Self =
Self::from_byte_slice_unchecked(&bytesvec) as *const Self as *mut Self;
assert_eq!(Layout::for_value(&*ptr), Layout::for_value(&*bytesvec));
// Forget the allocation
mem::forget(bytesvec);
// Transmute the pointer to an owned pointer
Expand Down
2 changes: 0 additions & 2 deletions utils/zerovec/src/yoke_impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,6 @@ impl<'a, T: 'static + AsULE + ?Sized> ZeroCopyFrom<ZeroVec<'a, T>> for ZeroVec<'

impl<'a, T: 'static + VarULE + ?Sized> ZeroCopyFrom<VarZeroVec<'a, T>> for VarZeroVec<'static, T> {
fn zero_copy_from<'b>(cart: &'b VarZeroVec<'a, T>) -> VarZeroVec<'b, T> {
// the owned variant is not compatible with the borrowed one
// clones are shallow for the borrowed variant anyway
cart.as_borrowed()
}
}
Expand Down

0 comments on commit 9db832d

Please sign in to comment.