aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2024-08-21 17:01:29 +0200
committerP-E-P <32375388+P-E-P@users.noreply.github.com>2024-09-26 22:48:32 +0000
commit76131dd1d561bdc2064e9f91ed19c275d09e7166 (patch)
tree78a3936fa61eea0b80e35f37acc488c182687883 /gcc
parentf899498e032260655fad98c83405d835b65b498f (diff)
downloadgcc-76131dd1d561bdc2064e9f91ed19c275d09e7166.zip
gcc-76131dd1d561bdc2064e9f91ed19c275d09e7166.tar.gz
gcc-76131dd1d561bdc2064e9f91ed19c275d09e7166.tar.bz2
Fix missing error on duplicated nodes
When we tried to insert a shadowable node and another shadowable node has been inserted before, we didn't emit any error if the node has already been inserted previously and failed silently. gcc/rust/ChangeLog: * resolve/rust-rib.cc (Rib::insert): Emit an error when trying to insert an already inserted node. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/resolve/rust-rib.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/rust/resolve/rust-rib.cc b/gcc/rust/resolve/rust-rib.cc
index a73e2bd..945e1c3 100644
--- a/gcc/rust/resolve/rust-rib.cc
+++ b/gcc/rust/resolve/rust-rib.cc
@@ -92,9 +92,9 @@ Rib::insert (std::string name, Definition def)
{
if (std::find (current.ids.cbegin (), current.ids.cend (), id)
== current.ids.cend ())
- {
- current.ids.push_back (id);
- }
+ current.ids.push_back (id);
+ else
+ return tl::make_unexpected (DuplicateNameError (name, id));
}
}
else if (it->second.shadowable)