]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Do not assert insertion result
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 17 Sep 2024 14:15:40 +0000 (16:15 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Wed, 19 Mar 2025 14:32:14 +0000 (15:32 +0100)
We might have some duplicated name in some pattern and we should
therefore not assert the non duplication of identifiers.

gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Remove
assertion and explicitely tells why we ignore the insertion result.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/resolve/rust-late-name-resolver-2.0.cc

index fa759d7bc8be56811aaa7c59a2646a39b2d2ba3c..df67b4f9873cccbb4b0a1c6b0d2c9bc857d33017 100644 (file)
@@ -152,10 +152,10 @@ Late::visit (AST::IdentifierPattern &identifier)
   // do we insert in labels or in values
   // but values does not allow shadowing... since functions cannot shadow
   // do we insert functions in labels as well?
-  auto ok
-    = ctx.values.insert (identifier.get_ident (), identifier.get_node_id ());
 
-  rust_assert (ok);
+  // We do want to ignore duplicated data because some situations rely on it.
+  std::ignore
+    = ctx.values.insert (identifier.get_ident (), identifier.get_node_id ());
 }
 
 void