]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Some assorted tweaks and bug fixes
authorOwen Avery <powerboat9.gamer@gmail.com>
Sat, 11 Jan 2025 05:15:05 +0000 (00:15 -0500)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Mon, 28 Apr 2025 11:13:51 +0000 (11:13 +0000)
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>
gcc/rust/ast/rust-ast-visitor.cc
gcc/rust/resolve/rust-early-name-resolver-2.0.cc
gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc

index 563bf7de959cd7a4ddadd29a4fbc83141d2cf10b..98691a11e8c4d64ea73b3df0bfe30b6904003f4e 100644 (file)
@@ -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 ());
 }
 
index 3470a7382dc13f86dd2f3c94703647c79591f143..3060b2904ec4b74e686a2d382da3cdfb82a214a5 100644 (file)
@@ -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;
 
index e276d65323e3d64d1eb88a0acc1b83e2dc617ef9..3ec06aaf0183ce58a2d9dd6e380bd8a398b75b05 100644 (file)
@@ -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