https://gcc.gnu.org/g:b56e0581412c9ed6bb280468456a78b320337eba

commit r17-1880-gb56e0581412c9ed6bb280468456a78b320337eba
Author: Arthur Cohen <[email protected]>
Date:   Wed Jun 3 11:23:57 2026 +0200

    gccrs: nr: Improve documentation around FinalizedNameResolutionContext
    
    gcc/rust/ChangeLog:
    
            * resolve/rust-early-name-resolver-2.0.cc 
(Early::finalize_simple_import): Cleanup
            dead code.
            (Early::finalize_rebind_import): Likewise.
            * resolve/rust-finalized-name-resolution-context.h: Add class 
documentation.

Diff:
---
 gcc/rust/resolve/rust-early-name-resolver-2.0.cc   |  4 ----
 .../rust-finalized-name-resolution-context.h       | 25 ++++++++++++++++++----
 2 files changed, 21 insertions(+), 8 deletions(-)

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 a7c9ea664f2d..0c5422d2c43a 100644
--- a/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-early-name-resolver-2.0.cc
@@ -461,8 +461,6 @@ Early::finalize_simple_import (const Early::ImportPair 
&mapping)
 
   for (auto &&definition : data.definitions ())
     {
-      // dirty = true;
-
       ctx.map_usage (Usage (import_id),
                     Definition (definition.definition.get_node_id ()),
                     definition.ns);
@@ -540,8 +538,6 @@ Early::finalize_rebind_import (const Early::ImportPair 
&mapping)
 
   for (auto &&definition : data.definitions ())
     {
-      // dirty = true;
-
       ctx.map_usage (Usage (import_id),
                     Definition (definition.definition.get_node_id ()),
                     definition.ns);
diff --git a/gcc/rust/resolve/rust-finalized-name-resolution-context.h 
b/gcc/rust/resolve/rust-finalized-name-resolution-context.h
index e29552d2b294..5f3354936268 100644
--- a/gcc/rust/resolve/rust-finalized-name-resolution-context.h
+++ b/gcc/rust/resolve/rust-finalized-name-resolution-context.h
@@ -26,18 +26,35 @@ namespace Rust {
 namespace Resolver2_0 {
 
 /**
- * Once the name resolution pass is complete, the typechecker can access it
+ * Once the name resolution pass is complete, later passes of the compiler can
+ * access it and still perform name resolution operations - for example, the
+ * typechecker is able to insert method resolution into the name resolution
+ * context.
  *
- * FIXME: More documentation
+ * Using this type instead of `NameResolutionContext` provides better APIs 
which
+ * are more suited to late passes, which shouldn't have to think about the 
inner
+ * workings of name resolution too much.
+ *
+ * This class provides wrappers around all basic name resolution operations
+ * (insertion, lookup) as well as an unsafe way to access the underlying name
+ * resolution context.
  */
 class FinalizedNameResolutionContext
 {
 public:
-  /** FIXME: Documentation */
+  /**
+   * Initialize the finalized name resolution context from a filled-out
+   * `NameResolutionContext`. This function should be called after name
+   * resolution is done, and `FinalizedNameResolutionContext` should be used
+   * instead of `NameResolutionContext` by later passes of the pipeline.
+   */
   static const FinalizedNameResolutionContext &
   init (NameResolutionContext &ctx);
 
-  /** FIXME: Documentation */
+  /**
+   * Access the finalized name resolution context that you previously
+   * initialized with `FinalizedNameResolutionContext::init`
+   */
   static FinalizedNameResolutionContext &get ();
 
   /**

Reply via email to