Skip to content

Add may_dangle Drop impl under the unstable flag - #91

Merged
emilio merged 2 commits into
mozilla:mainfrom
panstromek:dropck_eyepatch
Jul 22, 2026
Merged

Add may_dangle Drop impl under the unstable flag#91
emilio merged 2 commits into
mozilla:mainfrom
panstromek:dropck_eyepatch

Conversation

@panstromek

@panstromek panstromek commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

We use ThinVec quite a bit in the compiler, but there are cases where we can't, because it doesn't have #[may_dangle] on T. This is a case I recently encountered for example: https://github.com/rust-lang/rust/blob/ae3bbe78ec2a9bb57a03f10ad6ee0388e12bcefb/compiler/rustc_middle/src/mir/statement.rs#L1041

This PR adds the Drop impl under the existing unstable feature flag. I moved the cold drop function out of it to avoid duplicating too much code.

I followed a similar pattern as in servo/rust-smallvec#133, which did the same for smallvec (motivated by the compiler, too)

@emilio emilio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

@emilio
emilio merged commit 3ee2f89 into mozilla:main Jul 22, 2026
5 checks passed
@panstromek

Copy link
Copy Markdown
Contributor Author

That was quick, thanks a lot! Do you have a plan to release the new version anytime soon?

@emilio

emilio commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

5c0c9f5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants