Skip to content

Commit 06074ac

Browse files
committed
Auto merge of #32141 - jseyfried:fix_resolution_in_lexical_scopes, r=nikomatsakis
Fix name resolution in lexical scopes Currently, `resolve_item_in_lexical_scope` does not check the "ribs" (type parameters and local variables). This can allow items that should be shadowed by type parameters to be named. For example, ```rust struct T { i: i32 } fn f<T>() { let t = T { i: 0 }; // This use of `T` resolves to the struct, not the type parameter } mod Foo { pub fn f() {} } fn g<Foo>() { Foo::f(); // This use of `Foo` resolves to the module, not the type parameter } ``` This PR changes `resolve_item_in_lexical_scope` so that it fails when the item is shadowed by a rib (fixes #32120). This is a [breaking-change], but it looks unlikely to cause breakage in practice. r? @nikomatsakis
2 parents 3e05371 + e926f28 commit 06074ac

File tree

3 files changed

+75
-111
lines changed

3 files changed

+75
-111
lines changed

0 commit comments

Comments
 (0)