]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Remove some member functions from SingleASTNode
authorOwen Avery <powerboat9.gamer@gmail.com>
Sat, 22 Feb 2025 03:51:32 +0000 (22:51 -0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 24 Mar 2025 12:07:10 +0000 (13:07 +0100)
gcc/rust/ChangeLog:

* ast/rust-ast.h
(SingleASTNode::take_trait_item): Remove.
(SingleASTNode::take_impl_item): Remove.
(SingleASTNode::take_trait_impl_item): Remove.
* expand/rust-expand-visitor.cc
(ExpandVisitor::visit): Replace calls to aforementioned
functions with calls to SingleASTNode::take_assoc_item.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
gcc/rust/ast/rust-ast.h
gcc/rust/expand/rust-expand-visitor.cc

index 42be097f0567a34cb7156e60189edbd8b06748a9..4d7d23d23cc719606be4efac8551ca6afc83db69 100644 (file)
@@ -1996,13 +1996,6 @@ public:
     return std::move (item);
   }
 
-  std::unique_ptr<AssociatedItem> take_trait_item ()
-  {
-    rust_assert (!is_error ());
-    return std::unique_ptr<AssociatedItem> (
-      static_cast<AssociatedItem *> (assoc_item.release ()));
-  }
-
   std::unique_ptr<ExternalItem> take_external_item ()
   {
     rust_assert (!is_error ());
@@ -2015,16 +2008,6 @@ public:
     return std::move (assoc_item);
   }
 
-  std::unique_ptr<AssociatedItem> take_impl_item ()
-  {
-    return take_assoc_item ();
-  }
-
-  std::unique_ptr<AssociatedItem> take_trait_impl_item ()
-  {
-    return take_assoc_item ();
-  }
-
   std::unique_ptr<Type> take_type ()
   {
     rust_assert (!is_error ());
index 2830d200f72dafd94eb1384e17a1440d61eececb..1d131b181805968ce7eab58a6077eb65ac42ada1 100644 (file)
@@ -865,7 +865,7 @@ ExpandVisitor::visit (AST::Trait &trait)
 
   std::function<std::unique_ptr<AST::AssociatedItem> (AST::SingleASTNode)>
     extractor
-    = [] (AST::SingleASTNode node) { return node.take_trait_item (); };
+    = [] (AST::SingleASTNode node) { return node.take_assoc_item (); };
 
   expand_macro_children (MacroExpander::ContextType::TRAIT,
                         trait.get_trait_items (), extractor);
@@ -892,7 +892,8 @@ ExpandVisitor::visit (AST::InherentImpl &impl)
     expand_where_clause (impl.get_where_clause ());
 
   std::function<std::unique_ptr<AST::AssociatedItem> (AST::SingleASTNode)>
-    extractor = [] (AST::SingleASTNode node) { return node.take_impl_item (); };
+    extractor
+    = [] (AST::SingleASTNode node) { return node.take_assoc_item (); };
 
   expand_macro_children (MacroExpander::ContextType::IMPL,
                         impl.get_impl_items (), extractor);
@@ -920,7 +921,7 @@ ExpandVisitor::visit (AST::TraitImpl &impl)
 
   std::function<std::unique_ptr<AST::AssociatedItem> (AST::SingleASTNode)>
     extractor
-    = [] (AST::SingleASTNode node) { return node.take_trait_impl_item (); };
+    = [] (AST::SingleASTNode node) { return node.take_assoc_item (); };
 
   expand_macro_children (MacroExpander::ContextType::TRAIT_IMPL,
                         impl.get_impl_items (), extractor);