Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up`Arc` and `Rc` are dropck-unsound #29106
Comments
sfackler
added
the
I-wrong
label
Oct 16, 2015
This comment has been minimized.
This comment has been minimized.
|
triage: I-nominated |
rust-highfive
added
the
I-nominated
label
Oct 16, 2015
alexcrichton
added
the
T-libs
label
Oct 16, 2015
This comment has been minimized.
This comment has been minimized.
|
Hmm. My proposed fix causes a number of errors in run-pass/dropck_legal_cycles.rs. Investigating now. |
This comment has been minimized.
This comment has been minimized.
|
Fixing this was originally blocked on #26905 Should be fixable now, may require #[unsafe_destructor_blind_to_params] to pass that run-pass test. |
This comment has been minimized.
This comment has been minimized.
|
@Gankro |
This comment has been minimized.
This comment has been minimized.
|
Here are the exact compile errors with my patch:
|
jethrogb
referenced this issue
Oct 16, 2015
Closed
Valgrind shows invalid read/write when using threads #26442
This comment has been minimized.
This comment has been minimized.
|
Since the test errors are only related to |
apasel422
referenced this issue
Oct 16, 2015
Merged
Add `Shared` pointer and have `{Arc, Rc}` use it #29110
This comment has been minimized.
This comment has been minimized.
|
I can't believe I went through the exercise of writing up that dropck-legal-cycles test (and thus proved to myself the need for the attribute on (Part of the problem may be that we may not be documenting the right intuitions about what |
apasel422 commentedOct 16, 2015
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