-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-specializationArea: Trait impl specializationArea: Trait impl specializationA-trait-systemArea: Trait systemArea: Trait systemB-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.B-RFC-implementedBlocker: Approved by a merged RFC and implemented but not stabilized.Blocker: Approved by a merged RFC and implemented but not stabilized.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-specialization`#![feature(specialization)]``#![feature(specialization)]`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/SoundnessS-tracking-design-concernsStatus: There are blocking design concerns.Status: There are blocking design concerns.T-langRelevant to the language teamRelevant to the language teamrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
This is a tracking issue for specialization (rust-lang/rfcs#1210).
Major implementation steps:
- Land Implement RFC 1210: impl specialization #30652 =)
- Restrictions around lifetime dispatch (currently a soundness hole)
-
default impl
(supportdefault impl
for specialization #37653) - Integration with associated consts
- Bounds not always properly enforced (Trait bounds not checked on specializable associated types #33017)
- Should we permit empty impls if parent has no
default
members? 🛠️ specialization permits empty impls when parent has no default items #48444 - implement "always applicable" impls 🔬 implement "always applicable impls" #48538
- describe and test the precise cycle conditions around creating the specialization graph (see e.g. this comment, which noted that we have some very careful logic here today)
Unresolved questions from the RFC:
- Should associated type be specializable at all?
- When should projection reveal a
default type
? Never during typeck? Or when monomorphic? - Should default trait items be considered
default
(i.e. specializable)? - Should we have
default impl
(where all items aredefault
) orpartial impl
(wheredefault
is opt-in); see supportdefault impl
for specialization #37653 (comment) for some relevant examples of wheredefault impl
is limiting. - How should we deal with lifetime dispatchability?
Note that the specialization
feature as implemented currently is unsound, which means that it can cause Undefined Behavior without unsafe
code. min_specialization
avoids most of the pitfalls.
Tracking issues have a tendency to become unmanageable. Please open a dedicated new issue and label it with F-specialization for absolutely any topics you want to discuss or have questions about. See rust-lang/compiler-team#739 for details and discussions on this prospective policy.
ebkalderon, kevincox, porky11, greyblake, nvzqz and 450 moreTrard, Ha5hBr0wn, andreisilviudragnea, Adamkob12, kdwk and 1 moreschneiderfelipe, alisomay, seandewar, leighmcculloch, lastmjs and 16 moreArniDagur, agluszak, sagebind, SimonImbrogno, Kogia-sima and 97 moreiago-lito, yankana, 0x8f701, redradist, BenJeau and 56 moreathei, Noah-Kennedy, ArniDagur, lvxejay, TsumiNa and 71 more
Metadata
Metadata
Assignees
Labels
A-specializationArea: Trait impl specializationArea: Trait impl specializationA-trait-systemArea: Trait systemArea: Trait systemB-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.B-RFC-implementedBlocker: Approved by a merged RFC and implemented but not stabilized.Blocker: Approved by a merged RFC and implemented but not stabilized.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-specialization`#![feature(specialization)]``#![feature(specialization)]`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/SoundnessS-tracking-design-concernsStatus: There are blocking design concerns.Status: There are blocking design concerns.T-langRelevant to the language teamRelevant to the language teamrequires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.