-
-
Notifications
You must be signed in to change notification settings - Fork 15.1k
An associated type magically adds a destructor? #29821
Copy link
Copy link
Closed
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-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.
Metadata
Metadata
Assignees
Labels
A-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.T-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
These two code snippets should functionally be doing the same thing, but the type checker seems to think one has a destructor. The difference seems to be in the reliance on an associated type.
rustccomplains thatmyfoocannot be declared a mutable static because it has a desctructor:While this, unsurprisingly, works:
Here are links to non-compiling/compiling examples on play.rust-lang: