diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-11-18 13:53:47 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-11-18 13:53:47 +0000 |
commit | 0ecb6ea16bdec84016557536939140fea686f560 (patch) | |
tree | 8a4a116d01cf42ff7507832321618320eed77c3e /gcc/rust | |
parent | 0995184e26f81f8ba6872c3efb59f640a7fe7162 (diff) | |
download | gcc-0ecb6ea16bdec84016557536939140fea686f560.zip gcc-0ecb6ea16bdec84016557536939140fea686f560.tar.gz gcc-0ecb6ea16bdec84016557536939140fea686f560.tar.bz2 |
Remove implicit name hack for trait associated types
Before the TypePath resolution was updated to support associated type paths
and projections, we used an implict name hack of Self::<associated-type> as
well as the usual TraitName::<associates-type> this was a hack in the short
term to get things working which can now be removed.
Addresses: #739
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/resolve/rust-ast-resolve-item.h | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.h b/gcc/rust/resolve/rust-ast-resolve-item.h index 86c9934..f60732c 100644 --- a/gcc/rust/resolve/rust-ast-resolve-item.h +++ b/gcc/rust/resolve/rust-ast-resolve-item.h @@ -35,29 +35,14 @@ class ResolveTraitItems : public ResolverBase using Rust::Resolver::ResolverBase::visit; public: - static void go (AST::TraitItem *item, const CanonicalPath &self) + static void go (AST::TraitItem *item) { - ResolveTraitItems resolver (self); + ResolveTraitItems resolver; item->accept_vis (resolver); }; void visit (AST::TraitItemType &type) override { - // insert Self::type_alias for TypePath lookup - auto path - = self.append (ResolveTraitItemTypeToCanonicalPath::resolve (type)); - resolver->get_type_scope ().insert ( - path, type.get_node_id (), type.get_locus (), false, - [&] (const CanonicalPath &, NodeId, Location locus) -> void { - RichLocation r (type.get_locus ()); - r.add_range (locus); - rust_error_at (r, "redefined multiple times"); - }); - - // FIXME this stops the erronious unused decls which will be fixed later on - resolver->get_type_scope ().append_reference_for_def (type.get_node_id (), - type.get_node_id ()); - for (auto &bound : type.get_type_param_bounds ()) ResolveTypeBound::go (bound.get (), type.get_node_id ()); } @@ -189,11 +174,7 @@ public: } private: - ResolveTraitItems (const CanonicalPath &self) - : ResolverBase (UNKNOWN_NODEID), self (self) - {} - - const CanonicalPath &self; + ResolveTraitItems () : ResolverBase (UNKNOWN_NODEID) {} }; class ResolveItem : public ResolverBase @@ -649,7 +630,7 @@ public: for (auto &item : trait.get_trait_items ()) { - ResolveTraitItems::go (item.get (), Self); + ResolveTraitItems::go (item.get ()); } resolver->get_type_scope ().pop (); |