Skip to content

Fix inserting of trait items from trait constraints into namespace #7428

@ironcev

Description

@ironcev

Type checking of trait constraints inserts items of traits listed in the constraints, into the namespace.

E.g., the following project compiles without errors, because C gets inserted into the namespace of f.

library;

pub trait A {
    const C: bool;
}

struct S<T> { }

impl<T> S<T> {
    fn f() -> bool where T: A {
        C // <<<--- NO ERROR HERE!!
    }
}

Additionally, this insertion causes issues like #7396.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedcompiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgenteam:compilerCompiler Team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions