-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Arc and Rc are dropck-unsound #29106
Copy link
Copy link
Closed
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Output after compiling with
rustc 1.5.0-nightly (6cdf31b12 2015-10-15):Compiling with
alloc_systemand running under Valgrind confirms the use-after-free. Note that replacingArc::newwithRc::newresults in the same invalid runtime behavior, while replacing it withBox::newreports the correct lifetime error at compile time.I believe this is a result of
ArcandRcfailing to includePhantomData<T>in their internals~~, while simultaneously specifying#[unsafe_destructor_blind_to_params]on their destructors~~. Assuming my analysis of the issue is correct, I have a patch for this incoming, which will also address #29037.CC @pnkfelix @gankro