Closed mkatychev closed 1 week ago
Thanks for spotting and analyzing this. As I wrote in my comment on #7, the design of MownStr
was supposed to avoid double-free, so hope we can isolate this issue an better understand it.
Could this issue be related to this: https://doc.rust-lang.org/std/mem/fn.forget.html#relationship-with-manuallydrop ?
Using ManuallyDrop
or Box::leak
might be preferable.
UPDATE: wasn't able to produce a minimally viable example for the UB behaviour that is somewhat readable, for now miri checks on the tests should suffice. Box::leak
+ miri coverage should suffice for now.
I would like to follow up with the clippy lints for the naming schema in a breaking:
MownStr::from_str
and MownStr::borrowed
are too similar to stdlib methods and made debugging a crate that borrows from strings quite confusing.
Now that #8 has been merged (despite github thinking otherwise), can we close this issue?
Calling clone on an object holding a
sophia_inmem::graph::LightGraph
after cloning the object and dropping the original owner oftentimes results in undefined behaviour when attempting decode aMownStr
back into utf-8:Running
cargo +nightly miri test -- no_double_free
claims there is an invalid retag that violates stacked borrow rulesAttempts to reproduce this in a
mownstr
crate unit tests are ongoing.