Commit Message
Arthur Cohen
Aug. 1, 2024, 2:57 p.m. UTC
From: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc index 5c8d976b417..dc7cde1b323 100644 --- a/gcc/rust/resolve/rust-late-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-late-name-resolver-2.0.cc @@ -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