Skip to content
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

Merged
merged 2 commits into from
Oct 1, 2024

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Sep 27, 2024

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 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 #89144 for what makes a drop impl "significant"

@rustbot
Copy link
Collaborator

rustbot commented Sep 27, 2024

r? @Amanieu

rustbot has assigned @Amanieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 27, 2024
@compiler-errors
Copy link
Member Author

cc @dingxiangfei2009

@rust-log-analyzer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 27, 2024
…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<
Copy link
Member

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.

Copy link
Member Author

@compiler-errors compiler-errors Sep 30, 2024

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.

@Amanieu

This comment has been minimized.

@Amanieu
Copy link
Member

Amanieu commented Sep 30, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Sep 30, 2024

📌 Commit 24290ef has been approved by Amanieu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 30, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 30, 2024
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
@bors bors merged commit 2fe4186 into rust-lang:master Oct 1, 2024
6 checks passed
@rustbot rustbot added this to the 1.83.0 milestone Oct 1, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 1, 2024
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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants