Skip to content

Commit

Permalink
Don't consider RibKind::Module's bindings when checking generics shad…
Browse files Browse the repository at this point in the history
…owing
  • Loading branch information
compiler-errors committed Aug 19, 2024
1 parent c6f81a4 commit cc6888d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2677,14 +2677,14 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> {
// We also can't shadow bindings from associated parent items.
for ns in [ValueNS, TypeNS] {
for parent_rib in self.ribs[ns].iter().rev() {
seen_bindings
.extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span)));

// Break at mod level, to account for nested items which are
// allowed to shadow generic param names.
if matches!(parent_rib.kind, RibKind::Module(..)) {
break;
}

seen_bindings
.extend(parent_rib.bindings.keys().map(|ident| (*ident, ident.span)));
}
}

Expand Down

0 comments on commit cc6888d

Please sign in to comment.