]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Values shall be inserted in the value namespace
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 24 Jan 2024 16:00:29 +0000 (17:00 +0100)
committerP-E-P <32375388+P-E-P@users.noreply.github.com>
Tue, 26 Mar 2024 17:35:02 +0000 (17:35 +0000)
Values were inserted in the label namespace instead of the value
namespace this lead to several bugs.

gcc/rust/ChangeLog:

* resolve/rust-late-name-resolver-2.0.cc (Late::visit): Change the
namespace for values from "label" to "values".

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

index 5c8d976b41701df1e73ff9ae382c9967f1d49f61..dc7cde1b3233ddf2b344fc094c42382fb7ffc375 100644 (file)
@@ -151,7 +151,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?
-  new_label (identifier.get_ident (), identifier.get_node_id ());
+  auto ok
+    = ctx.values.insert (identifier.get_ident (), identifier.get_node_id ());
+
+  rust_assert (ok);
 }
 
 void