-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Can't specialize Drop #46893
Copy link
Copy link
Open
Labels
A-specializationArea: Trait impl specializationArea: Trait impl specializationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-specialization`#![feature(specialization)]``#![feature(specialization)]`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-specializationArea: Trait impl specializationArea: Trait impl specializationC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.F-specialization`#![feature(specialization)]``#![feature(specialization)]`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.
The
Droptrait has checks to ensure that theimplcan't add new restrictions on generic parameters.The above won't compile (as intended?), as the
Swould have a Drop that's conditional based on the type parameter.However with specialization we could have something like:
Both of these examples yield the same error
My first instinct was that this had something to do with the type information getting lost on destructors, but that doesn't seem to be the case as the issue can be worked around by specializing a different trait, to which
dropdelegates to:Linking to #31844