Skip to content

Commit

Permalink
Resolve SelfParam in name resolution 2.0
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* resolve/rust-late-name-resolver-2.0.cc
	(Late::visit): Handle SelfParam.
	* resolve/rust-late-name-resolver-2.0.h
	(Late::visit): Likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: Remove entries.

Signed-off-by: Owen Avery <[email protected]>
  • Loading branch information
powerboat9 authored and P-E-P committed Oct 29, 2024
1 parent 5ad1d88 commit d800490
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
12 changes: 12 additions & 0 deletions gcc/rust/resolve/rust-late-name-resolver-2.0.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,18 @@ Late::visit (AST::IdentifierPattern &identifier)
identifier.get_node_id ());
}

void
Late::visit (AST::SelfParam &param)
{
// handle similar to AST::IdentifierPattern

DefaultResolver::visit (param);
// FIXME: this location should be a bit off
// ex: would point to the begining of "mut self" instead of the "self"
std::ignore = ctx.values.insert (Identifier ("self", param.get_locus ()),
param.get_node_id ());
}

void
Late::visit (AST::IdentifierExpr &expr)
{
Expand Down
1 change: 1 addition & 0 deletions gcc/rust/resolve/rust-late-name-resolver-2.0.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Late : public DefaultResolver
// TODO: Do we need this?
// void visit (AST::Method &) override;
void visit (AST::IdentifierPattern &) override;
void visit (AST::SelfParam &) override;

// resolutions
void visit (AST::IdentifierExpr &) override;
Expand Down
4 changes: 0 additions & 4 deletions gcc/testsuite/rust/compile/nr2/exclude
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ derive_macro6.rs
expected_type_args2.rs
expected_type_args3.rs
feature_rust_attri0.rs
feature_rust_attri1.rs
for_lifetimes.rs
format_args_basic_expansion.rs
generic-default1.rs
Expand All @@ -54,13 +53,11 @@ infer-crate-name.rs
issue-1019.rs
issue-1031.rs
issue-1034.rs
issue-1128.rs
issue-1129-2.rs
issue-1130.rs
issue-1165.rs
issue-1173.rs
issue-1235.rs
issue-1237.rs
issue-1272.rs
issue-1289.rs
issue-1447.rs
Expand Down Expand Up @@ -167,7 +164,6 @@ redef_error2.rs
redef_error4.rs
redef_error5.rs
redef_error6.rs
rustc_attr1.rs
self-path1.rs
self-path2.rs
sizeof-stray-infer-var-bug.rs
Expand Down

0 comments on commit d800490

Please sign in to comment.