Closed maciejhirsz closed 4 years ago
Why use unsafe code here? This should be the same as just doing
let old = cow;
above, anddrop(old)
here (and you can even leave away the latter).
No good reason, I was messing around trying to make it drop when I fixed one of the two issues.
Miri is now tossing out this: Memory access failed: pointer must be in-bounds at offset 77309411346, but is outside bounds of allocation 30796 which has size 18
when accessing (*ptr).len()
. This is actually correct now (18 length, 18 capacity, 77309411346 == 18 | 18 (<< 32)
), is there a way to silence Miri only in a specific line?
Edit: I guess what I really need is a way to read the length from a raw fat pointer, without touching the actual pointer part of it.
Closing in favor of #14.
beef::Cow<'a, T>
is now a type alias tobeef::generic::Cow<'a, T, Wide>
whereWide
is private. This doesn't change anything, merely hidesOption<NonZeroUsize>
as implementation detail and makes errors more readable.impl_serde
feature which provides aSerialize
andDeserialize
trait implementations. Note that it's currently impossible to make it work with#[serde(borrow)]
(relevant PR).