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

array::Guard's drop isn't removed in opt-level=s for Copy types #128855

Closed
scottmcm opened this issue Aug 9, 2024 · 0 comments · Fixed by #128862
Closed

array::Guard's drop isn't removed in opt-level=s for Copy types #128855

scottmcm opened this issue Aug 9, 2024 · 0 comments · Fixed by #128862
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Comments

@scottmcm
Copy link
Member

scottmcm commented Aug 9, 2024

Happened to notice this in passing in https://rust.godbolt.org/z/eYxz4v4h3

The do-nothing function is still there:

define void @"_ZN69_$LT$core..array..Guard$LT$T$GT$$u20$as$u20$core..ops..drop..Drop$GT$4drop17hbb47c41452ebef2fE"(ptr noalias nocapture noundef readnone align 8 dereferenceable(24) %self) unnamed_addr #0 {
start:
  ret void
}

My guess is that this drop should be marked #[inline]:

impl<T> Drop for Guard<'_, T> {
fn drop(&mut self) {

@scottmcm scottmcm added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 9, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 9, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Aug 9, 2024
@bors bors closed this as completed in 1d8f135 Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants