diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-08-22 13:41:39 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-08-22 14:56:26 +0100 |
commit | d609accab78269afe7fae509a0b7bb36d6e9d14e (patch) | |
tree | 56ea6e1acc4a0ef2ca40a4ae8ba1b204399ea5d9 /gcc | |
parent | 95ad46b905b6e49c6888f2923347d0b85c466b96 (diff) | |
download | gcc-d609accab78269afe7fae509a0b7bb36d6e9d14e.zip gcc-d609accab78269afe7fae509a0b7bb36d6e9d14e.tar.gz gcc-d609accab78269afe7fae509a0b7bb36d6e9d14e.tar.bz2 |
add trait_reference is_equal helper method
We need to be able to detect if trait references are equal which can be
based on the DefId mapping which takes into account crate and local defid
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/typecheck/rust-hir-trait-ref.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/rust/typecheck/rust-hir-trait-ref.h b/gcc/rust/typecheck/rust-hir-trait-ref.h index 9d16e36..c86892e 100644 --- a/gcc/rust/typecheck/rust-hir-trait-ref.h +++ b/gcc/rust/typecheck/rust-hir-trait-ref.h @@ -335,6 +335,13 @@ public: } } + bool is_equal (const TraitReference &other) const + { + DefId this_id = get_mappings ().get_defid (); + DefId other_id = other.get_mappings ().get_defid (); + return this_id == other_id; + } + private: const HIR::Trait *hir_trait_ref; std::vector<TraitItemReference> item_refs; |