aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-08-10 12:22:25 +0000
committerGitHub <noreply@github.com>2021-08-10 12:22:25 +0000
commite10f3d65566101c774a308f8286e2827455941ed (patch)
tree3e1214d1140498353e483a2bbc182e669ecdd803 /gcc
parent5e723d0b7a85d109f01196b264a25823e77496e1 (diff)
parent226f2e4f13414e702b31f89ddf8176a9c916fee8 (diff)
downloadgcc-e10f3d65566101c774a308f8286e2827455941ed.zip
gcc-e10f3d65566101c774a308f8286e2827455941ed.tar.gz
gcc-e10f3d65566101c774a308f8286e2827455941ed.tar.bz2
Merge #618
618: Make insert_new_definition permissive of the same mapping. r=philberty a=philberty This was a fix required for `@dkm` work on the module support. Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/resolve/rust-ast-resolve.cc7
-rw-r--r--gcc/rust/resolve/rust-name-resolver.h5
2 files changed, 10 insertions, 2 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve.cc b/gcc/rust/resolve/rust-ast-resolve.cc
index 06a341a..1b77ae2 100644
--- a/gcc/rust/resolve/rust-ast-resolve.cc
+++ b/gcc/rust/resolve/rust-ast-resolve.cc
@@ -203,8 +203,11 @@ void
Resolver::insert_new_definition (NodeId id, Definition def)
{
auto it = name_definitions.find (id);
- rust_assert (it == name_definitions.end ());
-
+ if (it != name_definitions.end ())
+ {
+ rust_assert (it->second.is_equal (def));
+ return;
+ }
name_definitions[id] = def;
}
diff --git a/gcc/rust/resolve/rust-name-resolver.h b/gcc/rust/resolve/rust-name-resolver.h
index 7938c7c..23e5b65 100644
--- a/gcc/rust/resolve/rust-name-resolver.h
+++ b/gcc/rust/resolve/rust-name-resolver.h
@@ -356,6 +356,11 @@ struct Definition
NodeId node;
NodeId parent;
// add kind ?
+
+ bool is_equal (const Definition &other)
+ {
+ return node == other.node && parent == other.parent;
+ }
};
class Resolver