-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Arc
and Rc
are dropck-unsound
#29106
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
triage: I-nominated |
Hmm. My proposed fix causes a number of errors in run-pass/dropck_legal_cycles.rs. Investigating now. |
Fixing this was originally blocked on #26905 Should be fixable now, may require #[unsafe_destructor_blind_to_params] to pass that run-pass test. |
@gankro |
Here are the exact compile errors with my patch:
|
Since the test errors are only related to |
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 |
Output after compiling with
rustc 1.5.0-nightly (6cdf31b12 2015-10-15)
:Compiling with
alloc_system
and running under Valgrind confirms the use-after-free. Note that replacingArc::new
withRc::new
results in the same invalid runtime behavior, while replacing it withBox::new
reports the correct lifetime error at compile time.I believe this is a result of
Arc
andRc
failing 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
The text was updated successfully, but these errors were encountered: