(RFC 1210) specialization: restrictions around lifetime dispatch #45982
Labels
A-lifetimes
Area: Lifetimes / regions
A-specialization
Area: Trait impl specialization
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
F-specialization
`#![feature(specialization)]`
I-unsound
Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
requires-nightly
This issue requires a nightly compiler in some way.
S-tracking-design-concerns
Status: There are blocking design concerns.
T-lang
Relevant to the language team, which will review and decide on the PR/issue.
Note: #31844 is the tracking issue for specialization in general
this issue tracks the tasks to do to implement "restrictions around lifetime dispatch" as described here:
Specialization based on lifetimes shouldn't be allowed partly because "trans" erases any lifetime information and partly because lifetime inference could lead to counterintuitive result.
Unfotunately it's not easy to avoid any lifetime dependent specialization.
Additionally, using lifetime specialized associated types results in different deductions between type_check and trans
Things to do:
assoc_specialization
necessary when using specialization ondefault type
s.impl
imposes any lifetime constraints not present in the more generalimpl
.The warning should be issued at trans time when the more general
impl
is selected over the specializedimpl
, it could be relaxed or forbidden as described in this replyimpl
use the same lifetime constraints as the more generalimpl
, specialization should work as expected.@nikomatsakis
The text was updated successfully, but these errors were encountered: