Skip to content

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

Closed
@scottmcm

Description

@scottmcm

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) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.T-libsRelevant to the library team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions