diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc index a88adabb094..61e9ea4a928 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -103,6 +103,32 @@ TopLevel::visit (AST::Trait &trait) DefaultResolver::visit (trait); } +void +TopLevel::visit (AST::InherentImpl &impl) +{ + auto inner_fn = [this, &impl] () { + insert_or_error_out (Identifier ("Self", impl.get_type ().get_locus ()), + impl.get_type (), Namespace::Types); + + AST::DefaultASTVisitor::visit (impl); + }; + + ctx.scoped (Rib::Kind::TraitOrImpl, impl.get_node_id (), inner_fn); +} + +void +TopLevel::visit (AST::TraitImpl &impl) +{ + auto inner_fn = [this, &impl] () { + insert_or_error_out (Identifier ("Self", impl.get_type ().get_locus ()), + impl.get_type (), Namespace::Types); + + AST::DefaultASTVisitor::visit (impl); + }; + + ctx.scoped (Rib::Kind::TraitOrImpl, impl.get_node_id (), inner_fn); +} + void TopLevel::visit (AST::TraitItemType &trait_item) { diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h index 4b8a51cff9c..ff86cf48ba8 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h @@ -148,6 +148,8 @@ class TopLevel : public DefaultResolver void visit (AST::Module &module) override; void visit (AST::Trait &trait) override; + void visit (AST::InherentImpl &impl) override; + void visit (AST::TraitImpl &impl) override; void visit (AST::TraitItemType &trait_item) override; void visit (AST::MacroRulesDefinition ¯o) override; void visit (AST::Function &function) override; diff --git a/gcc/testsuite/rust/compile/nr2/exclude b/gcc/testsuite/rust/compile/nr2/exclude index af7d105debc..9b1ee7ceaf9 100644 --- a/gcc/testsuite/rust/compile/nr2/exclude +++ b/gcc/testsuite/rust/compile/nr2/exclude @@ -39,13 +39,11 @@ generics6.rs generics9.rs if_let_expr.rs issue-1019.rs -issue-1031.rs issue-1034.rs issue-1129-2.rs issue-1130.rs issue-1173.rs issue-1272.rs -issue-1289.rs issue-1447.rs issue-1483.rs issue-1725-1.rs @@ -85,7 +83,6 @@ issue-855.rs issue-925.rs iterators1.rs lookup_err1.rs -macros/mbe/macro-issue1233.rs macros/mbe/macro-issue1400.rs macros/mbe/macro13.rs macros/mbe/macro15.rs