-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark some more types as having insignificant dtor #130914
Conversation
This comment has been minimized.
This comment has been minimized.
002ff37
to
3a6df29
Compare
3a6df29
to
24290ef
Compare
…er, r=<try> [crater] validate impact of marking more types as `#[rustc_insignificant_dtor]` on tail expr drop order lint Validate impact of rust-lang#130914 on rust-lang#129864 and the tail expr drop order lint. r? `@ghost`
@@ -237,6 +237,7 @@ macro_rules! acquire { | |||
/// [rc_examples]: crate::rc#examples | |||
#[cfg_attr(not(test), rustc_diagnostic_item = "Arc")] | |||
#[stable(feature = "rust1", since = "1.0.0")] | |||
#[rustc_insignificant_dtor] | |||
pub struct Arc< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that this should also apply to Weak
? After all, the only thing that dropping a Weak
might do is freeing the Arc
and dropping the contained value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. This PR is not meant to be complete; I just marked types that I saw were missing from the fallout of the crater runs I linked above. I'd rather merge this in this state than modify it further.
This comment has been minimized.
This comment has been minimized.
@bors r+ |
Rollup of 5 pull requests Successful merges: - rust-lang#129638 (Hook up std::net to wasi-libc on wasm32-wasip2 target) - rust-lang#130877 (rustc_target: Add RISC-V atomic-related features) - rust-lang#130914 (Mark some more types as having insignificant dtor) - rust-lang#130961 (Enable `f16` tests on x86 Apple platforms) - rust-lang#130966 (make ptr metadata functions callable from stable const fn) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#130914 - compiler-errors:insignificant-dtor, r=Amanieu Mark some more types as having insignificant dtor These were caught by rust-lang#129864 (comment), which is implementing a lint for some changes in drop order for temporaries in tail expressions. Specifically, the destructors of `CString` and the bitpacked repr for `std::io::Error` are insignificant insofar as they don't have side-effects on things like locking or synchronization; they just free memory. See some discussion on rust-lang#89144 for what makes a drop impl "significant"
These were caught by #129864 (comment), which is implementing a lint for some changes in drop order for temporaries in tail expressions.
Specifically, the destructors of
CString
and the bitpacked repr forstd::io::Error
are insignificant insofar as they don't have side-effects on things like locking or synchronization; they just free memory.See some discussion on #89144 for what makes a drop impl "significant"