Skip to content

negative impls integrated into coherence #96

Closed
@nikomatsakis

Description

@nikomatsakis

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langfinal-comment-periodThe FCP has started, most (if not all) team members are in agreementmajor-changeMajor change proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions