-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Double Drop with #![deny(rust_2024_compatibility)] #134482
Copy link
Copy link
Closed
Labels
A-edition-2024Area: The 2024 editionArea: The 2024 editionC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessL-tail_expr_drop_orderLint: tail_expr_drop_orderLint: tail_expr_drop_orderP-criticalCritical priorityCritical priorityS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Metadata
Metadata
Assignees
Labels
A-edition-2024Area: The 2024 editionArea: The 2024 editionC-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessL-tail_expr_drop_orderLint: tail_expr_drop_orderLint: tail_expr_drop_orderP-criticalCritical priorityCritical priorityS-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I had a custom Rc that was doubly freeing memory because Drop was being called more times than it should.
After a little bit of testing I think this is a small enough Minimal-Reproducible-Example:
playground
I expected to see this happen: Drop is called twice.
Instead, this happened: Drop is called 3 times.
Notes
Result<String, ()>It seems that it happens as long as it is an enum in which one arm has a non-
Copytype.So it also happens if the return type is
--releaseflagMeta
rustc --version --verbose:Backtrace
Reduced stderr from the playground: