public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/rust/master] refactor class helper to create trait impl path segments into the CanonicalPath class itself
@ 2022-06-29 10:27 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2022-06-29 10:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:964969d4c608b058f37fafaef5e7f0f9ab7aef83

commit 964969d4c608b058f37fafaef5e7f0f9ab7aef83
Author: Philip Herron <philip.herron@embecosm.com>
Date:   Tue Jun 28 11:01:15 2022 +0100

    refactor class helper to create trait impl path segments into the CanonicalPath class itself

Diff:
---
 gcc/rust/resolve/rust-ast-resolve-item.cc    |  9 +++++----
 gcc/rust/resolve/rust-ast-resolve-toplevel.h |  5 +++--
 gcc/rust/resolve/rust-ast-resolve-type.cc    |  5 +++--
 gcc/rust/resolve/rust-ast-resolve-type.h     | 11 -----------
 gcc/rust/util/rust-canonical-path.h          |  8 ++++++++
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/gcc/rust/resolve/rust-ast-resolve-item.cc b/gcc/rust/resolve/rust-ast-resolve-item.cc
index 0c9536ff38d..222da03c002 100644
--- a/gcc/rust/resolve/rust-ast-resolve-item.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-item.cc
@@ -775,14 +775,15 @@ ResolveItem::visit (AST::TraitImpl &impl_block)
 					   type_resolve_generic_args);
 
   CanonicalPath projection
-    = TraitImplProjection::resolve (impl_block.get_node_id (), trait_type_seg,
-				    impl_type_seg);
+    = CanonicalPath::trait_impl_projection_seg (impl_block.get_node_id (),
+						trait_type_seg, impl_type_seg);
   CanonicalPath impl_prefix = prefix.append (projection);
 
   // setup canonical-path
   CanonicalPath canonical_projection
-    = TraitImplProjection::resolve (impl_block.get_node_id (),
-				    canonical_trait_type, canonical_impl_type);
+    = CanonicalPath::trait_impl_projection_seg (impl_block.get_node_id (),
+						canonical_trait_type,
+						canonical_impl_type);
   CanonicalPath cpath = CanonicalPath::create_empty ();
   if (canonical_prefix.size () <= 1)
     {
diff --git a/gcc/rust/resolve/rust-ast-resolve-toplevel.h b/gcc/rust/resolve/rust-ast-resolve-toplevel.h
index aed8565c8d5..15f5af7cb7c 100644
--- a/gcc/rust/resolve/rust-ast-resolve-toplevel.h
+++ b/gcc/rust/resolve/rust-ast-resolve-toplevel.h
@@ -355,8 +355,9 @@ public:
 					     type_resolve_generic_args);
 
     CanonicalPath projection
-      = TraitImplProjection::resolve (impl_block.get_node_id (), trait_type_seg,
-				      impl_type_seg);
+      = CanonicalPath::trait_impl_projection_seg (impl_block.get_node_id (),
+						  trait_type_seg,
+						  impl_type_seg);
     CanonicalPath impl_prefix = prefix.append (projection);
 
     resolver->get_name_scope ().insert (
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.cc b/gcc/rust/resolve/rust-ast-resolve-type.cc
index 553008d40cc..c5fe325c67f 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-type.cc
@@ -479,8 +479,9 @@ ResolveRelativeTypePath::resolve_qual_seg (AST::QualifiedPathType &seg,
   rust_assert (ok);
 
   CanonicalPath projection
-    = TraitImplProjection::resolve (seg.get_node_id (), *trait_type_seg,
-				    *impl_type_seg);
+    = CanonicalPath::trait_impl_projection_seg (seg.get_node_id (),
+						*trait_type_seg,
+						*impl_type_seg);
 
   result = result.append (projection);
   return true;
diff --git a/gcc/rust/resolve/rust-ast-resolve-type.h b/gcc/rust/resolve/rust-ast-resolve-type.h
index f7e17b01fe6..8f52c3ed08d 100644
--- a/gcc/rust/resolve/rust-ast-resolve-type.h
+++ b/gcc/rust/resolve/rust-ast-resolve-type.h
@@ -79,17 +79,6 @@ protected:
   bool failure_flag;
 };
 
-class TraitImplProjection
-{
-public:
-  static CanonicalPath resolve (NodeId id, const CanonicalPath &trait_seg,
-				const CanonicalPath &impl_type_seg)
-  {
-    return CanonicalPath::new_seg (id, "<" + impl_type_seg.get () + " as "
-					 + trait_seg.get () + ">");
-  }
-};
-
 class ResolveRelativeTypePath : public ResolveTypeToCanonicalPath
 {
   using ResolveTypeToCanonicalPath::visit;
diff --git a/gcc/rust/util/rust-canonical-path.h b/gcc/rust/util/rust-canonical-path.h
index 9b340750bba..54cc0390849 100644
--- a/gcc/rust/util/rust-canonical-path.h
+++ b/gcc/rust/util/rust-canonical-path.h
@@ -61,6 +61,14 @@ public:
 			  UNKNOWN_CREATENUM);
   }
 
+  static CanonicalPath
+  trait_impl_projection_seg (NodeId id, const CanonicalPath &trait_seg,
+			     const CanonicalPath &impl_type_seg)
+  {
+    return CanonicalPath::new_seg (id, "<" + impl_type_seg.get () + " as "
+					 + trait_seg.get () + ">");
+  }
+
   std::string get () const
   {
     std::string buf;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-29 10:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 10:27 [gcc/devel/rust/master] refactor class helper to create trait impl path segments into the CanonicalPath class itself Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).