Skip to content

Resolve is not detecting out-of-scope type parameters #14603

Closed
@nikomatsakis

Description

@nikomatsakis

There is currently some incorrect code in substitutions attempting to check for out-of-scope type parameters by detecting out-of-bounds indices. This is the wrong phase; this sort of lexical binding stuff is supposed to be handled by resolve. I have a fix coming in a PR today.

Here is a test that incorrectly compiles today as a result:

trait Trait<A> {
    fn outer(self) {
        enum Foo<B> {
            Variance(A)
        }
    }
}

fn main() { }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions