diff options
author | Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com> | 2024-08-21 17:01:29 +0200 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-19 15:32:13 +0100 |
commit | 57dc3ab97393f526afcc74fa6c82347f3f77402a (patch) | |
tree | 7461025ee8606b15bd4144306779d7c233d95a5a /gcc/rust/resolve/rust-rib.cc | |
parent | 1f556f071636fa2bd850958aaad33ec18d04c698 (diff) | |
download | gcc-57dc3ab97393f526afcc74fa6c82347f3f77402a.zip gcc-57dc3ab97393f526afcc74fa6c82347f3f77402a.tar.gz gcc-57dc3ab97393f526afcc74fa6c82347f3f77402a.tar.bz2 |
gccrs: 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/rust/resolve/rust-rib.cc')
-rw-r--r-- | gcc/rust/resolve/rust-rib.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/rust/resolve/rust-rib.cc b/gcc/rust/resolve/rust-rib.cc index 0a8fce3..7145072 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) |