public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] Fix duplicate detection
@ 2024-05-07 16:25 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2024-05-07 16:25 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6d4c2c9f5dd200f26d152ab8c170a930591d11ad

commit 6d4c2c9f5dd200f26d152ab8c170a930591d11ad
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Thu Sep 14 17:39:37 2023 +0200

    Fix duplicate detection
    
    The resolver did report duplicate symbols when being run multiple times
    even if the node id was the same. This commit adds an additional
    condition, the error will only be reported if the existing node id is
    different from the current node id.
    
    gcc/rust/ChangeLog:
    
            * resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::insert_or_error_out):
            Add new constraint to duplicate errors.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

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 446a1c6a41b1..407892bb7bbd 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
@@ -47,11 +47,8 @@ TopLevel::insert_or_error_out (const Identifier &identifier,
 
   auto result = ctx.insert (identifier, node_id, ns);
 
-  if (!result)
+  if (!result && result.error ().existing != node_id)
     {
-      // 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, locus);
       rich_loc.add_range (node_locations[result.error ().existing]);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-05-07 16:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-07 16:25 [gcc/devel/rust/master] Fix duplicate detection Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).