Skip to content

Explanation of E0207 is not what actually happens #62144

Closed
@yshui

Description

@yshui

Unconstrained lifetime parameters are actually allowed:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e4deca509f64a6d600ae49904e966124

Unlike what's described here:

E0207: r##"
Any type parameter or lifetime parameter of an `impl` must meet at least one of
the following criteria:
- it appears in the _implementing type_ of the impl, e.g. `impl<T> Foo<T>`
- for a trait impl, it appears in the _implemented trait_, e.g.
`impl<T> SomeTrait<T> for Foo`
- it is bound as an associated type, e.g. `impl<T, U> SomeTrait for T
where T: AnotherTrait<AssocType=U>`

For comparison, unconstrained type parameters do generate error:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a4d2a865a8a311e0eb46f8ed8583c671

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions