diff options
author | Owen Avery <powerboat9.gamer@gmail.com> | 2025-01-11 00:15:05 -0500 |
---|---|---|
committer | P-E-P <32375388+P-E-P@users.noreply.github.com> | 2025-04-28 11:13:51 +0000 |
commit | 7409c28ee0aa6c43149201e79969031a3021a6dd (patch) | |
tree | 643eb71d942a6f23160c7b0ce8cfb9a266cb02a2 /gcc | |
parent | b22c7d8df0b3adb17d26f302d192bef1816d5bca (diff) | |
download | gcc-7409c28ee0aa6c43149201e79969031a3021a6dd.zip gcc-7409c28ee0aa6c43149201e79969031a3021a6dd.tar.gz gcc-7409c28ee0aa6c43149201e79969031a3021a6dd.tar.bz2 |
Some assorted tweaks and bug fixes
gcc/rust/ChangeLog:
* ast/rust-ast-visitor.cc
(DefaultASTVisitor::visit): Visit the loop labels of
WhileLetLoopExpr instances before visiting their scrutinee
expressions.
* resolve/rust-early-name-resolver-2.0.cc
(Early::resolve_glob_import): Pass the glob import's path
directly to NameResolutionContext::resolve_path.
* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::visit): Remove unnecessary call to
Identifier::as_string.
(flatten_glob): Improve handling of cases where a glob use tree
has no path.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/ast/rust-ast-visitor.cc | 2 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-early-name-resolver-2.0.cc | 3 | ||||
-rw-r--r-- | gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 5 |
3 files changed, 5 insertions, 5 deletions
diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc index 563bf7d..98691a1 100644 --- a/gcc/rust/ast/rust-ast-visitor.cc +++ b/gcc/rust/ast/rust-ast-visitor.cc @@ -582,8 +582,8 @@ DefaultASTVisitor::visit (AST::WhileLetLoopExpr &expr) visit_outer_attrs (expr); for (auto &pattern : expr.get_patterns ()) visit (pattern); - visit (expr.get_scrutinee_expr ()); visit (expr.get_loop_label ()); + visit (expr.get_scrutinee_expr ()); visit (expr.get_loop_block ()); } diff --git a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc index 3470a73..3060b29 100644 --- a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc @@ -70,8 +70,7 @@ Early::go (AST::Crate &crate) bool Early::resolve_glob_import (NodeId use_dec_id, TopLevel::ImportKind &&glob) { - auto resolved - = ctx.resolve_path (glob.to_resolve.get_segments (), Namespace::Types); + auto resolved = ctx.resolve_path (glob.to_resolve, Namespace::Types); if (!resolved.has_value ()) return false; 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 e276d65..3ec06aa 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -135,8 +135,7 @@ TopLevel::visit (AST::Module &module) void TopLevel::visit (AST::Trait &trait) { - insert_or_error_out (trait.get_identifier ().as_string (), trait, - Namespace::Types); + insert_or_error_out (trait.get_identifier (), trait, Namespace::Types); DefaultResolver::visit (trait); } @@ -548,6 +547,8 @@ flatten_glob (const AST::UseTreeGlob &glob, std::vector<AST::SimplePath> &paths, { if (glob.has_path ()) paths.emplace_back (glob.get_path ()); + else + paths.emplace_back (AST::SimplePath ({}, false, glob.get_locus ())); } void |