Description
Proposal
Summary and problem statement
@yaahc and I have been investigating the possibility of integrating 'negative impls' into coherence. The precise motivation is to enable
impl !Error for &str { }
and then, in a downstream crate, support
impl From<&str> for Box<dyn Error>> { }
impl<E> From<E> for Box<dyn Error>>
where
E: Error, { }
Note that this would not permit where T: !Trait
syntax, although we could in principle support that, though we would have to be careful about what it means (in particular, it would be relatively easy to support if what it means is "there is a negative impl").
Motivation, use-cases, and solution sketches
- Supporting the project group's work, as described above
Prioritization
Fits under error handling, and is also a kind of core enabler likely to arise elsewhere
Links and related work
- Tracking isssue for negative impls Tracking issue for negative impls rust#68318
- Implementation of negative impls permit negative impls for non-auto traits rust#68004
- Interactions with marker traits and overlapping impls Tracking issue for allowing overlapping implementations for marker trait rust#29864
Initial people involved
nikomatsakis, yaahc
What happens now?
This issue is part of the experimental MCP process described in RFC 2936. Once this issue is filed, a Zulip topic will be opened for discussion, and the lang-team will review open MCPs in its weekly triage meetings. You should receive feedback within a week or two.
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.