From: Pierre-Emmanuel Patry Date: Wed, 21 Aug 2024 15:01:29 +0000 (+0200) Subject: Fix missing error on duplicated nodes X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76131dd1d561bdc2064e9f91ed19c275d09e7166;p=thirdparty%2Fgcc.git 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 --- diff --git a/gcc/rust/resolve/rust-rib.cc b/gcc/rust/resolve/rust-rib.cc index a73e2bd6f757..945e1c333caf 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)