]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: toplevel: Add comment about running the collector twice
authorArthur Cohen <arthur.cohen@embecosm.com>
Tue, 22 Aug 2023 15:29:56 +0000 (17:29 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 30 Jan 2024 11:36:46 +0000 (12:36 +0100)
gcc/rust/ChangeLog:

* resolve/rust-toplevel-name-resolver-2.0.cc
(TopLevel::insert_or_error_out): Add documentation comment.
(TopLevel::go): Likewise.

gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc

index fbded3e49e1814713ccd00cb7b3574750e613224..b9d0bc7c0ac90cbcbed68183966ee1ae58b2b9ec 100644 (file)
@@ -43,6 +43,9 @@ TopLevel::insert_or_error_out (const Identifier &identifier, const T &node,
 
   if (!result)
     {
+      // can we do something like check if the node id is the same? if it is the
+      // same, it's not an error, just the resolver running multiple times?
+
       rich_location rich_loc (line_table, loc);
       rich_loc.add_range (node_locations[result.error ().existing]);
 
@@ -54,6 +57,11 @@ TopLevel::insert_or_error_out (const Identifier &identifier, const T &node,
 void
 TopLevel::go (AST::Crate &crate)
 {
+  // we do not include builtin types in the top-level definition collector, as
+  // they are not used until `Late`. furthermore, we run this visitor multiple
+  // times in a row in a fixed-point fashion, so it would make the code
+  // responsible for this ugly and perfom a lot of error checking.
+
   for (auto &item : crate.items)
     item->accept_vis (*this);
 }