diff mbox series

[COMMITTED,24/25] gccrs: Remove obsolete classes and functions.

Message ID 20240207114419.1100894-25-arthur.cohen@embecosm.com
State New
Headers show
Series [COMMITTED,01/25] gccrs: Parse normal functions with `self` parameter correctly | expand

Commit Message

Arthur Cohen Feb. 7, 2024, 11:44 a.m. UTC
From: Kushal Pal <kushalpal109@gmail.com>

Trait functions now use AST::Function class, so classes
AST::TraitItemFunc, AST::TraitItemMethod, AST::TraitFunctionDecl,
AST::TraitMethodDecl and their related functions can be removed.

gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit):
	Remove obsolete classes and functions.
	* ast/rust-ast-collector.h:
	Likewise.
	* ast/rust-ast-full-decls.h (class TraitFunctionDecl):
	Likewise.
	(class TraitItemFunc):
	Likewise.
	(class TraitMethodDecl):
	Likewise.
	(class TraitItemMethod):
	Likewise.
	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit):
	Likewise.
	* ast/rust-ast-visitor.h:
	Likewise.
	* ast/rust-ast.cc (TraitItemFunc::TraitItemFunc):
	Likewise.
	(TraitItemFunc::operator=):
	Likewise.
	(TraitItemFunc::as_string):
	Likewise.
	(TraitFunctionDecl::as_string):
	Likewise.
	(TraitItemMethod::TraitItemMethod):
	Likewise.
	(TraitItemMethod::operator=):
	Likewise.
	(TraitItemMethod::as_string):
	Likewise.
	(TraitMethodDecl::as_string):
	Likewise.
	(TraitItemFunc::accept_vis):
	Likewise.
	(TraitItemMethod::accept_vis):
	Likewise.
	* ast/rust-item.h (class TraitFunctionDecl):
	Likewise.
	(class TraitItemFunc):
	Likewise.
	(class TraitMethodDecl):
	Likewise.
	(class TraitItemMethod):
	Likewise.
	* checks/errors/rust-ast-validation.cc (ASTValidation::visit):
	Likewise.
	* checks/errors/rust-ast-validation.h:
	Likewise.
	* checks/errors/rust-feature-gate.h:
	Likewise.
	* expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_trait_function_decl):
	Likewise.
	(CfgStrip::maybe_strip_trait_method_decl):
	Likewise.
	(CfgStrip::visit):
	Likewise.
	* expand/rust-cfg-strip.h:
	Likewise.
	* expand/rust-derive.h:
	Likewise.
	* expand/rust-expand-visitor.cc (ExpandVisitor::expand_trait_function_decl):
	Likewise.
	(ExpandVisitor::expand_trait_method_decl):
	Likewise.
	(ExpandVisitor::visit):
	Likewise.
	* expand/rust-expand-visitor.h:
	Likewise.
	* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit):
	Likewise.
	* hir/rust-ast-lower-base.h:
	Likewise.
	* hir/rust-ast-lower-implitem.cc (ASTLowerTraitItem::visit):
	Likewise.
	* hir/rust-ast-lower-implitem.h:
	Likewise.
	* resolve/rust-ast-resolve-base.cc (ResolverBase::visit):
	Likewise.
	* resolve/rust-ast-resolve-base.h:
	Likewise.
	* resolve/rust-ast-resolve-implitem.h (visit):
	Likewise.
	* resolve/rust-ast-resolve-item.cc (ResolveTraitItems::visit):
	Likewise.
	* resolve/rust-ast-resolve-item.h:
	Likewise.
	* resolve/rust-default-resolver.cc (DefaultResolver::visit):
	Likewise.
	* resolve/rust-default-resolver.h:
	Likewise.
	* resolve/rust-toplevel-name-resolver-2.0.cc (TopLevel::visit):
	Likewise.
	* resolve/rust-toplevel-name-resolver-2.0.h:
	Likewise.
	* util/rust-attributes.cc (AttributeChecker::visit):
	Likewise.
	* util/rust-attributes.h:
	Likewise.

Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
---
 gcc/rust/ast/rust-ast-collector.cc            |  34 --
 gcc/rust/ast/rust-ast-collector.h             |   2 -
 gcc/rust/ast/rust-ast-full-decls.h            |   4 -
 gcc/rust/ast/rust-ast-visitor.cc              |  45 --
 gcc/rust/ast/rust-ast-visitor.h               |   6 -
 gcc/rust/ast/rust-ast.cc                      | 209 ---------
 gcc/rust/ast/rust-item.h                      | 406 ------------------
 gcc/rust/checks/errors/rust-ast-validation.cc |  17 -
 gcc/rust/checks/errors/rust-ast-validation.h  |   1 -
 gcc/rust/checks/errors/rust-feature-gate.h    |   2 -
 gcc/rust/expand/rust-cfg-strip.cc             | 105 -----
 gcc/rust/expand/rust-cfg-strip.h              |   4 -
 gcc/rust/expand/rust-derive.h                 |   2 -
 gcc/rust/expand/rust-expand-visitor.cc        |  54 ---
 gcc/rust/expand/rust-expand-visitor.h         |   4 -
 gcc/rust/hir/rust-ast-lower-base.cc           |   6 -
 gcc/rust/hir/rust-ast-lower-base.h            |   2 -
 gcc/rust/hir/rust-ast-lower-implitem.cc       | 159 -------
 gcc/rust/hir/rust-ast-lower-implitem.h        |   2 -
 gcc/rust/resolve/rust-ast-resolve-base.cc     |   8 -
 gcc/rust/resolve/rust-ast-resolve-base.h      |   2 -
 gcc/rust/resolve/rust-ast-resolve-implitem.h  |  40 --
 gcc/rust/resolve/rust-ast-resolve-item.cc     | 155 -------
 gcc/rust/resolve/rust-ast-resolve-item.h      |   2 -
 gcc/rust/resolve/rust-default-resolver.cc     |   8 -
 gcc/rust/resolve/rust-default-resolver.h      |   2 -
 .../rust-toplevel-name-resolver-2.0.cc        |  10 -
 .../resolve/rust-toplevel-name-resolver-2.0.h |   1 -
 gcc/rust/util/rust-attributes.cc              |   8 -
 gcc/rust/util/rust-attributes.h               |   2 -
 30 files changed, 1302 deletions(-)
diff mbox series

Patch

diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc
index d5a98f1ccc7..fb0e6f9be1d 100644
--- a/gcc/rust/ast/rust-ast-collector.cc
+++ b/gcc/rust/ast/rust-ast-collector.cc
@@ -1948,23 +1948,6 @@  TokenCollector::visit_function_common (std::unique_ptr<Type> &return_type,
     }
 }
 
-void
-TokenCollector::visit (TraitItemFunc &item)
-{
-  auto func = item.get_trait_function_decl ();
-  auto id = func.get_identifier ().as_string ();
-
-  push (Rust::Token::make (FN_KW, item.get_locus ()));
-  push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
-  push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
-
-  visit_items_joined_by_separator (func.get_function_params ());
-
-  push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
-
-  visit_function_common (func.get_return_type (), item.get_definition ());
-}
-
 void
 TokenCollector::visit (SelfParam &param)
 {
@@ -1987,23 +1970,6 @@  TokenCollector::visit (SelfParam &param)
     }
 }
 
-void
-TokenCollector::visit (TraitItemMethod &item)
-{
-  auto method = item.get_trait_method_decl ();
-  auto id = method.get_identifier ().as_string ();
-
-  push (Rust::Token::make (FN_KW, item.get_locus ()));
-  push (Rust::Token::make_identifier (UNDEF_LOCATION, std::move (id)));
-  push (Rust::Token::make (LEFT_PAREN, UNDEF_LOCATION));
-
-  visit_items_joined_by_separator (method.get_function_params (), COMMA);
-
-  push (Rust::Token::make (RIGHT_PAREN, UNDEF_LOCATION));
-
-  visit_function_common (method.get_return_type (), item.get_definition ());
-}
-
 void
 TokenCollector::visit (TraitItemConst &item)
 {
diff --git a/gcc/rust/ast/rust-ast-collector.h b/gcc/rust/ast/rust-ast-collector.h
index 55c13d103d0..246411fa15f 100644
--- a/gcc/rust/ast/rust-ast-collector.h
+++ b/gcc/rust/ast/rust-ast-collector.h
@@ -325,9 +325,7 @@  public:
   void visit (Union &union_item);
   void visit (ConstantItem &const_item);
   void visit (StaticItem &static_item);
-  void visit (TraitItemFunc &item);
   void visit (SelfParam &param);
-  void visit (TraitItemMethod &item);
   void visit (TraitItemConst &item);
   void visit (TraitItemType &item);
   void visit (Trait &trait);
diff --git a/gcc/rust/ast/rust-ast-full-decls.h b/gcc/rust/ast/rust-ast-full-decls.h
index 0f95149a214..c96bbfb07d9 100644
--- a/gcc/rust/ast/rust-ast-full-decls.h
+++ b/gcc/rust/ast/rust-ast-full-decls.h
@@ -193,10 +193,6 @@  class Enum;
 class Union;
 class ConstantItem;
 class StaticItem;
-class TraitFunctionDecl;
-class TraitItemFunc;
-class TraitMethodDecl;
-class TraitItemMethod;
 class TraitItemConst;
 class TraitItemType;
 class Trait;
diff --git a/gcc/rust/ast/rust-ast-visitor.cc b/gcc/rust/ast/rust-ast-visitor.cc
index 586570377aa..cb7ba846c39 100644
--- a/gcc/rust/ast/rust-ast-visitor.cc
+++ b/gcc/rust/ast/rust-ast-visitor.cc
@@ -911,51 +911,6 @@  DefaultASTVisitor::visit (AST::StaticItem &static_item)
   visit (static_item.get_expr ());
 }
 
-void
-DefaultASTVisitor::visit (AST::TraitFunctionDecl &decl)
-{
-  visit (decl.get_qualifiers ());
-  for (auto &generic : decl.get_generic_params ())
-    visit (generic);
-  visit (decl.get_where_clause ());
-  for (auto &param : decl.get_function_params ())
-    visit (param);
-  if (decl.has_return_type ())
-    visit (decl.get_return_type ());
-}
-
-void
-DefaultASTVisitor::visit (AST::TraitItemFunc &item)
-{
-  visit_outer_attrs (item);
-  visit (item.get_trait_function_decl ());
-  if (item.has_definition ())
-    visit (item.get_definition ());
-}
-
-void
-DefaultASTVisitor::visit (AST::TraitMethodDecl &decl)
-{
-  visit (decl.get_qualifiers ());
-  for (auto &generic : decl.get_generic_params ())
-    visit (generic);
-  visit (decl.get_where_clause ());
-  visit (decl.get_self_param ());
-  for (auto &param : decl.get_function_params ())
-    visit (param);
-  if (decl.has_return_type ())
-    visit (decl.get_return_type ());
-}
-
-void
-DefaultASTVisitor::visit (AST::TraitItemMethod &item)
-{
-  visit_outer_attrs (item);
-  visit (item.get_trait_method_decl ());
-  if (item.has_definition ())
-    visit (item.get_definition ());
-}
-
 void
 DefaultASTVisitor::visit (AST::TraitItemConst &item)
 {
diff --git a/gcc/rust/ast/rust-ast-visitor.h b/gcc/rust/ast/rust-ast-visitor.h
index 43cd750f5f7..6c9715eb077 100644
--- a/gcc/rust/ast/rust-ast-visitor.h
+++ b/gcc/rust/ast/rust-ast-visitor.h
@@ -156,8 +156,6 @@  public:
   virtual void visit (Union &union_item) = 0;
   virtual void visit (ConstantItem &const_item) = 0;
   virtual void visit (StaticItem &static_item) = 0;
-  virtual void visit (TraitItemFunc &item) = 0;
-  virtual void visit (TraitItemMethod &item) = 0;
   virtual void visit (TraitItemConst &item) = 0;
   virtual void visit (TraitItemType &item) = 0;
   virtual void visit (Trait &trait) = 0;
@@ -330,8 +328,6 @@  protected:
   virtual void visit (AST::Union &union_item) override;
   virtual void visit (AST::ConstantItem &const_item) override;
   virtual void visit (AST::StaticItem &static_item) override;
-  virtual void visit (AST::TraitItemFunc &item) override;
-  virtual void visit (AST::TraitItemMethod &item) override;
   virtual void visit (AST::TraitItemConst &item) override;
   virtual void visit (AST::TraitItemType &item) override;
   virtual void visit (AST::Trait &trait) override;
@@ -420,8 +416,6 @@  protected:
   virtual void visit (AST::WhereClause &where);
   virtual void visit (AST::StructField &field);
   virtual void visit (AST::TupleField &field);
-  virtual void visit (AST::TraitFunctionDecl &decl);
-  virtual void visit (AST::TraitMethodDecl &decl);
   virtual void visit (AST::NamedFunctionParam &param);
   virtual void visit (AST::MacroRule &rule);
   virtual void visit (AST::MacroInvocData &data);
diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc
index 360a9ceb6db..90fe9269404 100644
--- a/gcc/rust/ast/rust-ast.cc
+++ b/gcc/rust/ast/rust-ast.cc
@@ -3049,203 +3049,6 @@  NamedFunctionParam::as_string () const
   return str;
 }
 
-TraitItemFunc::TraitItemFunc (TraitItemFunc const &other)
-  : TraitItem (other.locus), outer_attrs (other.outer_attrs), decl (other.decl)
-{
-  node_id = other.node_id;
-
-  // guard to prevent null dereference
-  if (other.block_expr != nullptr)
-    block_expr = other.block_expr->clone_block_expr ();
-}
-
-TraitItemFunc &
-TraitItemFunc::operator= (TraitItemFunc const &other)
-{
-  TraitItem::operator= (other);
-  outer_attrs = other.outer_attrs;
-  decl = other.decl;
-  locus = other.locus;
-  node_id = other.node_id;
-
-  // guard to prevent null dereference
-  if (other.block_expr != nullptr)
-    block_expr = other.block_expr->clone_block_expr ();
-  else
-    block_expr = nullptr;
-
-  return *this;
-}
-std::string
-TraitItemFunc::as_string () const
-{
-  std::string str = append_attributes (outer_attrs, OUTER);
-
-  str += "\n" + decl.as_string ();
-
-  str += "\n Definition (block expr): ";
-  if (has_definition ())
-    str += block_expr->as_string ();
-  else
-    str += "none";
-
-  return str;
-}
-
-std::string
-TraitFunctionDecl::as_string () const
-{
-  std::string str
-    = qualifiers.as_string () + "fn " + function_name.as_string ();
-
-  // generic params
-  str += "\n Generic params: ";
-  if (generic_params.empty ())
-    {
-      str += "none";
-    }
-  else
-    {
-      for (const auto &param : generic_params)
-	{
-	  // DEBUG: null pointer check
-	  if (param == nullptr)
-	    {
-	      rust_debug (
-		"something really terrible has gone wrong - null pointer "
-		"generic param in trait function decl.");
-	      return "NULL_POINTER_MARK";
-	    }
-
-	  str += "\n  " + param->as_string ();
-	}
-    }
-
-  str += "\n Function params: ";
-  if (has_params ())
-    {
-      for (const auto &param : function_params)
-	str += "\n  " + param->as_string ();
-    }
-  else
-    {
-      str += "none";
-    }
-
-  str += "\n Return type: ";
-  if (has_return_type ())
-    str += return_type->as_string ();
-  else
-    str += "none (void)";
-
-  str += "\n Where clause: ";
-  if (has_where_clause ())
-    str += where_clause.as_string ();
-  else
-    str += "none";
-
-  return str;
-}
-
-TraitItemMethod::TraitItemMethod (TraitItemMethod const &other)
-  : TraitItem (other.locus), outer_attrs (other.outer_attrs), decl (other.decl)
-{
-  node_id = other.node_id;
-
-  // guard to prevent null dereference
-  if (other.block_expr != nullptr)
-    block_expr = other.block_expr->clone_block_expr ();
-}
-
-TraitItemMethod &
-TraitItemMethod::operator= (TraitItemMethod const &other)
-{
-  TraitItem::operator= (other);
-  outer_attrs = other.outer_attrs;
-  decl = other.decl;
-  locus = other.locus;
-  node_id = other.node_id;
-
-  // guard to prevent null dereference
-  if (other.block_expr != nullptr)
-    block_expr = other.block_expr->clone_block_expr ();
-  else
-    block_expr = nullptr;
-
-  return *this;
-}
-
-std::string
-TraitItemMethod::as_string () const
-{
-  std::string str = append_attributes (outer_attrs, OUTER);
-
-  str += "\n" + decl.as_string ();
-
-  str += "\n Definition (block expr): ";
-  if (has_definition ())
-    str += block_expr->as_string ();
-  else
-    str += "none";
-
-  return str;
-}
-
-std::string
-TraitMethodDecl::as_string () const
-{
-  std::string str
-    = qualifiers.as_string () + "fn " + function_name.as_string ();
-
-  // generic params
-  str += "\n Generic params: ";
-  if (generic_params.empty ())
-    {
-      str += "none";
-    }
-  else
-    {
-      for (const auto &param : generic_params)
-	{
-	  // DEBUG: null pointer check
-	  if (param == nullptr)
-	    {
-	      rust_debug (
-		"something really terrible has gone wrong - null pointer "
-		"generic param in trait function decl.");
-	      return "NULL_POINTER_MARK";
-	    }
-
-	  str += "\n  " + param->as_string ();
-	}
-    }
-
-  str += "\n Function params: ";
-  if (has_params ())
-    {
-      for (const auto &param : function_params)
-	str += "\n  " + param->as_string ();
-    }
-  else
-    {
-      str += "none";
-    }
-
-  str += "\n Return type: ";
-  if (has_return_type ())
-    str += return_type->as_string ();
-  else
-    str += "none (void)";
-
-  str += "\n Where clause: ";
-  if (has_where_clause ())
-    str += where_clause.as_string ();
-  else
-    str += "none";
-
-  return str;
-}
-
 std::string
 TraitItemConst::as_string () const
 {
@@ -5017,18 +4820,6 @@  StaticItem::accept_vis (ASTVisitor &vis)
   vis.visit (*this);
 }
 
-void
-TraitItemFunc::accept_vis (ASTVisitor &vis)
-{
-  vis.visit (*this);
-}
-
-void
-TraitItemMethod::accept_vis (ASTVisitor &vis)
-{
-  vis.visit (*this);
-}
-
 void
 TraitItemConst::accept_vis (ASTVisitor &vis)
 {
diff --git a/gcc/rust/ast/rust-item.h b/gcc/rust/ast/rust-item.h
index 1defecc4452..0911719b716 100644
--- a/gcc/rust/ast/rust-item.h
+++ b/gcc/rust/ast/rust-item.h
@@ -2531,412 +2531,6 @@  protected:
   }
 };
 
-// Function declaration in traits
-class TraitFunctionDecl
-{
-  // TODO: delete and replace with Function decl item? no as no body in this.
-  FunctionQualifiers qualifiers;
-  Identifier function_name;
-
-  // bool has_generics;
-  // Generics generic_params;
-  std::vector<std::unique_ptr<GenericParam>> generic_params; // inlined
-
-  // bool has_params;
-  // FunctionParams function_params;
-  std::vector<std::unique_ptr<Param>> function_params; // inlined
-
-  // bool has_return_type;
-  std::unique_ptr<Type> return_type;
-
-  // bool has_where_clause;
-  WhereClause where_clause;
-
-  // should this store location info?
-
-public:
-  // Returns whether function decl has generic parameters.
-  bool has_generics () const { return !generic_params.empty (); }
-
-  // Returns whether function decl has regular parameters.
-  bool has_params () const { return !function_params.empty (); }
-
-  // Returns whether function has return type (otherwise is void).
-  bool has_return_type () const { return return_type != nullptr; }
-
-  // Returns whether function has a where clause.
-  bool has_where_clause () const { return !where_clause.is_empty (); }
-
-  Identifier get_identifier () const { return function_name; }
-
-  // Mega-constructor
-  TraitFunctionDecl (Identifier function_name, FunctionQualifiers qualifiers,
-		     std::vector<std::unique_ptr<GenericParam>> generic_params,
-		     std::vector<std::unique_ptr<Param>> function_params,
-		     std::unique_ptr<Type> return_type,
-		     WhereClause where_clause)
-    : qualifiers (std::move (qualifiers)),
-      function_name (std::move (function_name)),
-      generic_params (std::move (generic_params)),
-      function_params (std::move (function_params)),
-      return_type (std::move (return_type)),
-      where_clause (std::move (where_clause))
-  {}
-
-  // Copy constructor with clone
-  TraitFunctionDecl (TraitFunctionDecl const &other)
-    : qualifiers (other.qualifiers), function_name (other.function_name),
-      where_clause (other.where_clause)
-  {
-    // guard to prevent nullptr dereference
-    if (other.return_type != nullptr)
-      return_type = other.return_type->clone_type ();
-
-    generic_params.reserve (other.generic_params.size ());
-    for (const auto &e : other.generic_params)
-      generic_params.push_back (e->clone_generic_param ());
-
-    function_params.reserve (other.function_params.size ());
-    for (const auto &e : other.function_params)
-      function_params.push_back (e->clone_param ());
-  }
-
-  ~TraitFunctionDecl () = default;
-
-  // Overloaded assignment operator with clone
-  TraitFunctionDecl &operator= (TraitFunctionDecl const &other)
-  {
-    function_name = other.function_name;
-    qualifiers = other.qualifiers;
-    where_clause = other.where_clause;
-
-    // guard to prevent nullptr dereference
-    if (other.return_type != nullptr)
-      return_type = other.return_type->clone_type ();
-    else
-      return_type = nullptr;
-
-    generic_params.reserve (other.generic_params.size ());
-    for (const auto &e : other.generic_params)
-      generic_params.push_back (e->clone_generic_param ());
-
-    function_params.reserve (other.function_params.size ());
-    for (const auto &e : other.function_params)
-      function_params.push_back (e->clone_param ());
-
-    return *this;
-  }
-
-  // move constructors
-  TraitFunctionDecl (TraitFunctionDecl &&other) = default;
-  TraitFunctionDecl &operator= (TraitFunctionDecl &&other) = default;
-
-  std::string as_string () const;
-
-  // Invalid if function name is empty, so base stripping on that.
-  void mark_for_strip () { function_name = {""}; }
-  bool is_marked_for_strip () const { return function_name.empty (); }
-
-  // TODO: this mutable getter seems really dodgy. Think up better way.
-  std::vector<std::unique_ptr<Param>> &get_function_params ()
-  {
-    return function_params;
-  }
-  const std::vector<std::unique_ptr<Param>> &get_function_params () const
-  {
-    return function_params;
-  }
-
-  std::vector<std::unique_ptr<GenericParam>> &get_generic_params ()
-  {
-    return generic_params;
-  }
-  const std::vector<std::unique_ptr<GenericParam>> &get_generic_params () const
-  {
-    return generic_params;
-  }
-
-  // TODO: is this better? Or is a "vis_block" better?
-  std::unique_ptr<Type> &get_return_type () { return return_type; }
-
-  // TODO: is this better? Or is a "vis_block" better?
-  WhereClause &get_where_clause () { return where_clause; }
-
-  FunctionQualifiers get_qualifiers () const { return qualifiers; }
-  FunctionQualifiers &get_qualifiers () { return qualifiers; }
-};
-
-// Actual trait item function declaration within traits
-class TraitItemFunc : public TraitItem
-{
-  std::vector<Attribute> outer_attrs;
-  TraitFunctionDecl decl;
-  std::unique_ptr<BlockExpr> block_expr;
-
-public:
-  // Returns whether function has a definition or is just a declaration.
-  bool has_definition () const { return block_expr != nullptr; }
-
-  TraitItemFunc (TraitFunctionDecl decl, std::unique_ptr<BlockExpr> block_expr,
-		 std::vector<Attribute> outer_attrs, location_t locus)
-    : TraitItem (locus), outer_attrs (std::move (outer_attrs)),
-      decl (std::move (decl)), block_expr (std::move (block_expr))
-  {}
-
-  // Copy constructor with clone
-  TraitItemFunc (TraitItemFunc const &other);
-
-  // Overloaded assignment operator to clone
-
-  TraitItemFunc &operator= (TraitItemFunc const &other);
-
-  // move constructors
-  TraitItemFunc (TraitItemFunc &&other) = default;
-  TraitItemFunc &operator= (TraitItemFunc &&other) = default;
-
-  std::string as_string () const override;
-
-  void accept_vis (ASTVisitor &vis) override;
-
-  // Invalid if trait decl is empty, so base stripping on that.
-  void mark_for_strip () override { decl.mark_for_strip (); }
-  bool is_marked_for_strip () const override
-  {
-    return decl.is_marked_for_strip ();
-  }
-
-  // TODO: this mutable getter seems really dodgy. Think up better way.
-  std::vector<Attribute> &get_outer_attrs () { return outer_attrs; }
-  const std::vector<Attribute> &get_outer_attrs () const { return outer_attrs; }
-
-  // TODO: is this better? Or is a "vis_block" better?
-  std::unique_ptr<BlockExpr> &get_definition () { return block_expr; }
-
-  // TODO: is this better? Or is a "vis_block" better?
-  TraitFunctionDecl &get_trait_function_decl ()
-  {
-    // TODO: maybe only allow access if not marked for strip?
-    return decl;
-  }
-
-protected:
-  // Clone function implementation as (not pure) virtual method
-  TraitItemFunc *clone_associated_item_impl () const override
-  {
-    return new TraitItemFunc (*this);
-  }
-};
-
-// Method declaration within traits
-class TraitMethodDecl
-{
-  // TODO: delete and replace with Function decl item? no as no body.
-  FunctionQualifiers qualifiers;
-  Identifier function_name;
-
-  // bool has_generics;
-  // Generics generic_params;
-  std::vector<std::unique_ptr<GenericParam>> generic_params; // inlined
-
-  // bool has_params;
-  // FunctionParams function_params;
-  std::vector<std::unique_ptr<Param>> function_params; // inlined
-
-  // bool has_return_type;
-  std::unique_ptr<Type> return_type;
-
-  // bool has_where_clause;
-  WhereClause where_clause;
-
-  // should this store location info?
-
-public:
-  // Returns whether method decl has generic parameters.
-  bool has_generics () const { return !generic_params.empty (); }
-
-  // Returns whether method decl has regular parameters.
-  bool has_params () const { return !function_params.empty (); }
-
-  // Returns whether method has return type (otherwise is void).
-  bool has_return_type () const { return return_type != nullptr; }
-
-  // Returns whether method has a where clause.
-  bool has_where_clause () const { return !where_clause.is_empty (); }
-
-  Identifier get_identifier () const { return function_name; }
-
-  // Mega-constructor
-  TraitMethodDecl (Identifier function_name, FunctionQualifiers qualifiers,
-		   std::vector<std::unique_ptr<GenericParam>> generic_params,
-		   std::vector<std::unique_ptr<Param>> function_params,
-		   std::unique_ptr<Type> return_type, WhereClause where_clause)
-    : qualifiers (std::move (qualifiers)),
-      function_name (std::move (function_name)),
-      generic_params (std::move (generic_params)),
-      function_params (std::move (function_params)),
-      return_type (std::move (return_type)),
-      where_clause (std::move (where_clause))
-  {}
-
-  // Copy constructor with clone
-  TraitMethodDecl (TraitMethodDecl const &other)
-    : qualifiers (other.qualifiers), function_name (other.function_name),
-      where_clause (other.where_clause)
-  {
-    // guard to prevent nullptr dereference
-    if (other.return_type != nullptr)
-      return_type = other.return_type->clone_type ();
-
-    generic_params.reserve (other.generic_params.size ());
-    for (const auto &e : other.generic_params)
-      generic_params.push_back (e->clone_generic_param ());
-
-    function_params.reserve (other.function_params.size ());
-    for (const auto &e : other.function_params)
-      function_params.push_back (e->clone_param ());
-  }
-
-  ~TraitMethodDecl () = default;
-
-  // Overloaded assignment operator with clone
-  TraitMethodDecl &operator= (TraitMethodDecl const &other)
-  {
-    function_name = other.function_name;
-    qualifiers = other.qualifiers;
-    where_clause = other.where_clause;
-
-    // guard to prevent nullptr dereference
-    if (other.return_type != nullptr)
-      return_type = other.return_type->clone_type ();
-    else
-      return_type = nullptr;
-
-    generic_params.reserve (other.generic_params.size ());
-    for (const auto &e : other.generic_params)
-      generic_params.push_back (e->clone_generic_param ());
-
-    function_params.reserve (other.function_params.size ());
-    for (const auto &e : other.function_params)
-      function_params.push_back (e->clone_param ());
-
-    return *this;
-  }
-
-  // move constructors
-  TraitMethodDecl (TraitMethodDecl &&other) = default;
-  TraitMethodDecl &operator= (TraitMethodDecl &&other) = default;
-
-  std::string as_string () const;
-
-  // Invalid if method name is empty, so base stripping on that.
-  void mark_for_strip () { function_name = {""}; }
-  bool is_marked_for_strip () const { return function_name.empty (); }
-
-  // TODO: this mutable getter seems really dodgy. Think up better way.
-  std::vector<std::unique_ptr<Param>> &get_function_params ()
-  {
-    return function_params;
-  }
-  const std::vector<std::unique_ptr<Param>> &get_function_params () const
-  {
-    return function_params;
-  }
-
-  std::vector<std::unique_ptr<GenericParam>> &get_generic_params ()
-  {
-    return generic_params;
-  }
-  const std::vector<std::unique_ptr<GenericParam>> &get_generic_params () const
-  {
-    return generic_params;
-  }
-
-  // TODO: is this better? Or is a "vis_block" better?
-  std::unique_ptr<Type> &get_return_type () { return return_type; }
-
-  // TODO: is this better? Or is a "vis_block" better?
-  WhereClause &get_where_clause () { return where_clause; }
-
-  bool has_self () const
-  {
-    return !function_params.empty () && function_params[0]->is_self ();
-  }
-
-  std::unique_ptr<Param> &get_self_param ()
-  {
-    rust_assert (has_self ());
-    return function_params[0];
-  }
-  const std::unique_ptr<Param> &get_self_param () const
-  {
-    rust_assert (has_self ());
-    return function_params[0];
-  }
-
-  FunctionQualifiers get_qualifiers () const { return qualifiers; }
-
-  FunctionQualifiers &get_qualifiers () { return qualifiers; }
-};
-
-// Actual trait item method declaration within traits
-class TraitItemMethod : public TraitItem
-{
-  std::vector<Attribute> outer_attrs;
-  TraitMethodDecl decl;
-  std::unique_ptr<BlockExpr> block_expr;
-
-public:
-  // Returns whether method has a definition or is just a declaration.
-  bool has_definition () const { return block_expr != nullptr; }
-
-  TraitItemMethod (TraitMethodDecl decl, std::unique_ptr<BlockExpr> block_expr,
-		   std::vector<Attribute> outer_attrs, location_t locus)
-    : TraitItem (locus), outer_attrs (std::move (outer_attrs)),
-      decl (std::move (decl)), block_expr (std::move (block_expr))
-  {}
-
-  // Copy constructor with clone
-  TraitItemMethod (TraitItemMethod const &other);
-  // Overloaded assignment operator to clone
-  TraitItemMethod &operator= (TraitItemMethod const &other);
-
-  // move constructors
-  TraitItemMethod (TraitItemMethod &&other) = default;
-  TraitItemMethod &operator= (TraitItemMethod &&other) = default;
-
-  std::string as_string () const override;
-
-  void accept_vis (ASTVisitor &vis) override;
-
-  // Invalid if trait decl is empty, so base stripping on that.
-  void mark_for_strip () override { decl.mark_for_strip (); }
-  bool is_marked_for_strip () const override
-  {
-    return decl.is_marked_for_strip ();
-  }
-
-  // TODO: this mutable getter seems really dodgy. Think up better way.
-  std::vector<Attribute> &get_outer_attrs () { return outer_attrs; }
-  const std::vector<Attribute> &get_outer_attrs () const { return outer_attrs; }
-
-  // TODO: is this better? Or is a "vis_block" better?
-  TraitMethodDecl &get_trait_method_decl ()
-  {
-    // TODO: maybe only allow access if not marked for strip?
-    return decl;
-  }
-
-  // TODO: is this better? Or is a "vis_block" better?
-  std::unique_ptr<BlockExpr> &get_definition () { return block_expr; }
-
-protected:
-  // Clone function implementation as (not pure) virtual method
-  TraitItemMethod *clone_associated_item_impl () const override
-  {
-    return new TraitItemMethod (*this);
-  }
-};
-
 // Constant item within traits
 class TraitItemConst : public TraitItem
 {
diff --git a/gcc/rust/checks/errors/rust-ast-validation.cc b/gcc/rust/checks/errors/rust-ast-validation.cc
index d1c8273a0b3..d57b7cb70fe 100644
--- a/gcc/rust/checks/errors/rust-ast-validation.cc
+++ b/gcc/rust/checks/errors/rust-ast-validation.cc
@@ -140,23 +140,6 @@  ASTValidation::visit (AST::Function &function)
   AST::ContextualASTVisitor::visit (function);
 }
 
-void
-ASTValidation::visit (AST::TraitFunctionDecl &decl)
-{
-  const auto &qualifiers = decl.get_qualifiers ();
-
-  if (context.back () == Context::TRAIT)
-    {
-      // may change soon
-      if (qualifiers.is_async ())
-	rust_error_at (decl.get_identifier ().get_locus (), ErrorCode::E0706,
-		       "functions in traits cannot be declared %<async%>");
-      if (qualifiers.is_const ())
-	rust_error_at (decl.get_identifier ().get_locus (), ErrorCode::E0379,
-		       "functions in traits cannot be declared %<const%>");
-    }
-}
-
 void
 ASTValidation::visit (AST::Trait &trait)
 {
diff --git a/gcc/rust/checks/errors/rust-ast-validation.h b/gcc/rust/checks/errors/rust-ast-validation.h
index 963357f86cd..01d923ceff3 100644
--- a/gcc/rust/checks/errors/rust-ast-validation.h
+++ b/gcc/rust/checks/errors/rust-ast-validation.h
@@ -42,7 +42,6 @@  public:
   virtual void visit (AST::Union &item);
   virtual void visit (AST::Function &function);
   virtual void visit (AST::Trait &trait);
-  virtual void visit (AST::TraitFunctionDecl &decl);
 };
 
 } // namespace Rust
diff --git a/gcc/rust/checks/errors/rust-feature-gate.h b/gcc/rust/checks/errors/rust-feature-gate.h
index 8d1a26a1361..ef7449aa581 100644
--- a/gcc/rust/checks/errors/rust-feature-gate.h
+++ b/gcc/rust/checks/errors/rust-feature-gate.h
@@ -125,8 +125,6 @@  public:
   void visit (AST::Union &union_item) override {}
   void visit (AST::ConstantItem &const_item) override {}
   void visit (AST::StaticItem &static_item) override {}
-  void visit (AST::TraitItemFunc &item) override {}
-  void visit (AST::TraitItemMethod &item) override {}
   void visit (AST::TraitItemConst &item) override {}
   void visit (AST::TraitItemType &item) override {}
   void visit (AST::Trait &trait) override {}
diff --git a/gcc/rust/expand/rust-cfg-strip.cc b/gcc/rust/expand/rust-cfg-strip.cc
index 22f3127f587..2b51a890247 100644
--- a/gcc/rust/expand/rust-cfg-strip.cc
+++ b/gcc/rust/expand/rust-cfg-strip.cc
@@ -375,56 +375,6 @@  CfgStrip::maybe_strip_where_clause (AST::WhereClause &where_clause)
     item->accept_vis (*this);
 }
 
-void
-CfgStrip::maybe_strip_trait_function_decl (AST::TraitFunctionDecl &decl)
-{
-  // just expand sub-stuff - can't actually strip generic params themselves
-  for (auto &param : decl.get_generic_params ())
-    param->accept_vis (*this);
-
-  /* strip function parameters if required - this is specifically
-   * allowed by spec */
-  maybe_strip_function_params (decl.get_function_params ());
-
-  if (decl.has_return_type ())
-    {
-      auto &return_type = decl.get_return_type ();
-      return_type->accept_vis (*this);
-
-      if (return_type->is_marked_for_strip ())
-	rust_error_at (return_type->get_locus (),
-		       "cannot strip type in this position");
-    }
-
-  if (decl.has_where_clause ())
-    maybe_strip_where_clause (decl.get_where_clause ());
-}
-
-void
-CfgStrip::maybe_strip_trait_method_decl (AST::TraitMethodDecl &decl)
-{
-  // just expand sub-stuff - can't actually strip generic params themselves
-  for (auto &param : decl.get_generic_params ())
-    param->accept_vis (*this);
-
-  /* strip function parameters if required - this is specifically
-   * allowed by spec */
-  maybe_strip_function_params (decl.get_function_params ());
-
-  if (decl.has_return_type ())
-    {
-      auto &return_type = decl.get_return_type ();
-      return_type->accept_vis (*this);
-
-      if (return_type->is_marked_for_strip ())
-	rust_error_at (return_type->get_locus (),
-		       "cannot strip type in this position");
-    }
-
-  if (decl.has_where_clause ())
-    maybe_strip_where_clause (decl.get_where_clause ());
-}
-
 void
 CfgStrip::visit (AST::IdentifierExpr &ident_expr)
 {
@@ -2080,61 +2030,6 @@  CfgStrip::visit (AST::StaticItem &static_item)
 		   "cannot strip expression in this position - outer "
 		   "attributes not allowed");
 }
-void
-CfgStrip::visit (AST::TraitItemFunc &item)
-{
-  // initial test based on outer attrs
-  expand_cfg_attrs (item.get_outer_attrs ());
-  if (fails_cfg_with_expand (item.get_outer_attrs ()))
-    {
-      item.mark_for_strip ();
-      return;
-    }
-
-  maybe_strip_trait_function_decl (item.get_trait_function_decl ());
-
-  AST::DefaultASTVisitor::visit (item);
-
-  if (item.has_definition ())
-    {
-      /* strip any internal sub-expressions - expression itself isn't
-       * allowed to have external attributes in this position so can't be
-       * stripped. */
-      auto &block = item.get_definition ();
-      if (block->is_marked_for_strip ())
-	rust_error_at (block->get_locus (),
-		       "cannot strip block expression in this "
-		       "position - outer attributes not allowed");
-    }
-}
-
-void
-CfgStrip::visit (AST::TraitItemMethod &item)
-{
-  // initial test based on outer attrs
-  expand_cfg_attrs (item.get_outer_attrs ());
-  if (fails_cfg_with_expand (item.get_outer_attrs ()))
-    {
-      item.mark_for_strip ();
-      return;
-    }
-
-  maybe_strip_trait_method_decl (item.get_trait_method_decl ());
-
-  AST::DefaultASTVisitor::visit (item);
-
-  if (item.has_definition ())
-    {
-      /* strip any internal sub-expressions - expression itself isn't
-       * allowed to have external attributes in this position so can't be
-       * stripped. */
-      auto &block = item.get_definition ();
-      if (block->is_marked_for_strip ())
-	rust_error_at (block->get_locus (),
-		       "cannot strip block expression in this "
-		       "position - outer attributes not allowed");
-    }
-}
 
 void
 CfgStrip::visit (AST::TraitItemConst &item)
diff --git a/gcc/rust/expand/rust-cfg-strip.h b/gcc/rust/expand/rust-cfg-strip.h
index 6b968b31d05..a3931823ab1 100644
--- a/gcc/rust/expand/rust-cfg-strip.h
+++ b/gcc/rust/expand/rust-cfg-strip.h
@@ -42,8 +42,6 @@  public:
   void maybe_strip_closure_params (std::vector<AST::ClosureParam> &params);
   void maybe_strip_self_param (AST::SelfParam &self_param);
   void maybe_strip_where_clause (AST::WhereClause &where_clause);
-  void maybe_strip_trait_function_decl (AST::TraitFunctionDecl &decl);
-  void maybe_strip_trait_method_decl (AST::TraitMethodDecl &decl);
 
   /**
    * maybe_strip a set of values, erasing them if they are marked for strip.
@@ -145,8 +143,6 @@  public:
   void visit (AST::Union &union_item) override;
   void visit (AST::ConstantItem &const_item) override;
   void visit (AST::StaticItem &static_item) override;
-  void visit (AST::TraitItemFunc &item) override;
-  void visit (AST::TraitItemMethod &item) override;
   void visit (AST::TraitItemConst &item) override;
   void visit (AST::TraitItemType &item) override;
   void visit (AST::Trait &trait) override;
diff --git a/gcc/rust/expand/rust-derive.h b/gcc/rust/expand/rust-derive.h
index d5c8b44442d..1531d81f57c 100644
--- a/gcc/rust/expand/rust-derive.h
+++ b/gcc/rust/expand/rust-derive.h
@@ -159,8 +159,6 @@  private:
   virtual void visit (EnumItemDiscriminant &item) override final{};
   virtual void visit (ConstantItem &const_item) override final{};
   virtual void visit (StaticItem &static_item) override final{};
-  virtual void visit (TraitItemFunc &item) override final{};
-  virtual void visit (TraitItemMethod &item) override final{};
   virtual void visit (TraitItemConst &item) override final{};
   virtual void visit (TraitItemType &item) override final{};
   virtual void visit (Trait &trait) override final{};
diff --git a/gcc/rust/expand/rust-expand-visitor.cc b/gcc/rust/expand/rust-expand-visitor.cc
index bc0149ca99d..e42715b865f 100644
--- a/gcc/rust/expand/rust-expand-visitor.cc
+++ b/gcc/rust/expand/rust-expand-visitor.cc
@@ -437,42 +437,6 @@  ExpandVisitor::expand_where_clause (AST::WhereClause &where_clause)
     visit (item);
 }
 
-void
-ExpandVisitor::expand_trait_function_decl (AST::TraitFunctionDecl &decl)
-{
-  // just expand sub-stuff - can't actually strip generic params themselves
-  for (auto &param : decl.get_generic_params ())
-    visit (param);
-
-  /* strip function parameters if required - this is specifically
-   * allowed by spec */
-  expand_function_params (decl.get_function_params ());
-
-  if (decl.has_return_type ())
-    maybe_expand_type (decl.get_return_type ());
-
-  if (decl.has_where_clause ())
-    expand_where_clause (decl.get_where_clause ());
-}
-
-void
-ExpandVisitor::expand_trait_method_decl (AST::TraitMethodDecl &decl)
-{
-  for (auto &param : decl.get_generic_params ())
-    visit (param);
-
-  /* strip function parameters if required - this is specifically
-   * allowed by spec */
-  expand_function_params (decl.get_function_params ());
-
-  if (decl.has_return_type ())
-
-    maybe_expand_type (decl.get_return_type ());
-
-  if (decl.has_where_clause ())
-    expand_where_clause (decl.get_where_clause ());
-}
-
 void
 ExpandVisitor::visit (AST::Crate &crate)
 {
@@ -862,24 +826,6 @@  ExpandVisitor::visit (AST::StaticItem &static_item)
   maybe_expand_expr (static_item.get_expr ());
 }
 
-void
-ExpandVisitor::visit (AST::TraitItemFunc &item)
-{
-  expand_trait_function_decl (item.get_trait_function_decl ());
-
-  if (item.has_definition ())
-    visit (item.get_definition ());
-}
-
-void
-ExpandVisitor::visit (AST::TraitItemMethod &item)
-{
-  expand_trait_method_decl (item.get_trait_method_decl ());
-
-  if (item.has_definition ())
-    visit (item.get_definition ());
-}
-
 void
 ExpandVisitor::visit (AST::TraitItemConst &const_item)
 {
diff --git a/gcc/rust/expand/rust-expand-visitor.h b/gcc/rust/expand/rust-expand-visitor.h
index bae9b0f8fa5..8f61db659c3 100644
--- a/gcc/rust/expand/rust-expand-visitor.h
+++ b/gcc/rust/expand/rust-expand-visitor.h
@@ -86,8 +86,6 @@  public:
   // FIXME: Add documentation
   void expand_closure_params (std::vector<AST::ClosureParam> &params);
   void expand_where_clause (AST::WhereClause &where_clause);
-  void expand_trait_function_decl (AST::TraitFunctionDecl &decl);
-  void expand_trait_method_decl (AST::TraitMethodDecl &decl);
 
   /**
    * Expand a set of values, erasing them if they are marked for strip, and
@@ -248,8 +246,6 @@  public:
   void visit (AST::Union &union_item) override;
   void visit (AST::ConstantItem &const_item) override;
   void visit (AST::StaticItem &static_item) override;
-  void visit (AST::TraitItemFunc &item) override;
-  void visit (AST::TraitItemMethod &item) override;
   void visit (AST::TraitItemConst &item) override;
   void visit (AST::Trait &trait) override;
   void visit (AST::InherentImpl &impl) override;
diff --git a/gcc/rust/hir/rust-ast-lower-base.cc b/gcc/rust/hir/rust-ast-lower-base.cc
index 19f20885209..3ff0f52e0c6 100644
--- a/gcc/rust/hir/rust-ast-lower-base.cc
+++ b/gcc/rust/hir/rust-ast-lower-base.cc
@@ -321,12 +321,6 @@  void
 ASTLoweringBase::visit (AST::StaticItem &)
 {}
 void
-ASTLoweringBase::visit (AST::TraitItemFunc &)
-{}
-void
-ASTLoweringBase::visit (AST::TraitItemMethod &)
-{}
-void
 ASTLoweringBase::visit (AST::TraitItemConst &)
 {}
 void
diff --git a/gcc/rust/hir/rust-ast-lower-base.h b/gcc/rust/hir/rust-ast-lower-base.h
index 8da11750d18..d7b94ac8a70 100644
--- a/gcc/rust/hir/rust-ast-lower-base.h
+++ b/gcc/rust/hir/rust-ast-lower-base.h
@@ -177,8 +177,6 @@  public:
   virtual void visit (AST::Union &union_item);
   virtual void visit (AST::ConstantItem &const_item);
   virtual void visit (AST::StaticItem &static_item);
-  virtual void visit (AST::TraitItemFunc &item);
-  virtual void visit (AST::TraitItemMethod &item);
   virtual void visit (AST::TraitItemConst &item);
   virtual void visit (AST::TraitItemType &item);
   virtual void visit (AST::Trait &trait);
diff --git a/gcc/rust/hir/rust-ast-lower-implitem.cc b/gcc/rust/hir/rust-ast-lower-implitem.cc
index 77230e7a8bf..399c3fb8179 100644
--- a/gcc/rust/hir/rust-ast-lower-implitem.cc
+++ b/gcc/rust/hir/rust-ast-lower-implitem.cc
@@ -313,165 +313,6 @@  ASTLowerTraitItem::visit (AST::Function &func)
     }
 }
 
-void
-ASTLowerTraitItem::visit (AST::TraitItemFunc &func)
-{
-  AST::TraitFunctionDecl &ref = func.get_trait_function_decl ();
-  std::vector<std::unique_ptr<HIR::WhereClauseItem> > where_clause_items;
-  HIR::WhereClause where_clause (std::move (where_clause_items));
-  HIR::FunctionQualifiers qualifiers
-    = lower_qualifiers (func.get_trait_function_decl ().get_qualifiers ());
-
-  std::vector<std::unique_ptr<HIR::GenericParam> > generic_params;
-  if (ref.has_generics ())
-    {
-      generic_params = lower_generic_params (ref.get_generic_params ());
-    }
-
-  std::unique_ptr<HIR::Type> return_type
-    = ref.has_return_type () ? std::unique_ptr<HIR::Type> (
-	ASTLoweringType::translate (ref.get_return_type ().get ()))
-			     : nullptr;
-
-  std::vector<HIR::FunctionParam> function_params;
-  for (auto &p : ref.get_function_params ())
-    {
-      if (p->is_variadic () || p->is_self ())
-	continue;
-
-      auto param = static_cast<AST::FunctionParam *> (p.get ());
-
-      auto translated_pattern = std::unique_ptr<HIR::Pattern> (
-	ASTLoweringPattern::translate (param->get_pattern ().get ()));
-      auto translated_type = std::unique_ptr<HIR::Type> (
-	ASTLoweringType::translate (param->get_type ().get ()));
-
-      auto crate_num = mappings->get_current_crate ();
-      Analysis::NodeMapping mapping (crate_num, param->get_node_id (),
-				     mappings->get_next_hir_id (crate_num),
-				     UNKNOWN_LOCAL_DEFID);
-
-      auto hir_param
-	= HIR::FunctionParam (mapping, std::move (translated_pattern),
-			      std::move (translated_type), param->get_locus ());
-      function_params.push_back (std::move (hir_param));
-    }
-
-  HIR::TraitFunctionDecl decl (ref.get_identifier (), std::move (qualifiers),
-			       std::move (generic_params),
-			       HIR::SelfParam::error (),
-			       std::move (function_params),
-			       std::move (return_type),
-			       std::move (where_clause));
-  bool terminated = false;
-  std::unique_ptr<HIR::BlockExpr> block_expr
-    = func.has_definition () ? std::unique_ptr<HIR::BlockExpr> (
-	ASTLoweringBlock::translate (func.get_definition ().get (),
-				     &terminated))
-			     : nullptr;
-
-  auto crate_num = mappings->get_current_crate ();
-  Analysis::NodeMapping mapping (crate_num, func.get_node_id (),
-				 mappings->get_next_hir_id (crate_num),
-				 mappings->get_next_localdef_id (crate_num));
-
-  HIR::TraitItemFunc *trait_item
-    = new HIR::TraitItemFunc (mapping, std::move (decl), std::move (block_expr),
-			      func.get_outer_attrs (), func.get_locus ());
-  translated = trait_item;
-
-  // add the mappings for the function params at the end
-  for (auto &param : trait_item->get_decl ().get_function_params ())
-    {
-      mappings->insert_hir_param (&param);
-      mappings->insert_location (mapping.get_hirid (), param.get_locus ());
-    }
-}
-
-void
-ASTLowerTraitItem::visit (AST::TraitItemMethod &method)
-{
-  AST::TraitMethodDecl &ref = method.get_trait_method_decl ();
-
-  std::vector<std::unique_ptr<HIR::WhereClauseItem> > where_clause_items;
-  HIR::WhereClause where_clause (std::move (where_clause_items));
-  HIR::FunctionQualifiers qualifiers
-    = lower_qualifiers (method.get_trait_method_decl ().get_qualifiers ());
-
-  std::vector<std::unique_ptr<HIR::GenericParam> > generic_params;
-  if (ref.has_generics ())
-    {
-      generic_params = lower_generic_params (ref.get_generic_params ());
-    }
-
-  std::unique_ptr<HIR::Type> return_type
-    = ref.has_return_type () ? std::unique_ptr<HIR::Type> (
-	ASTLoweringType::translate (ref.get_return_type ().get ()))
-			     : nullptr;
-
-  HIR::SelfParam self_param = lower_self (ref.get_self_param ());
-
-  std::vector<HIR::FunctionParam> function_params;
-  for (auto &p : ref.get_function_params ())
-    {
-      if (p->is_variadic () || p->is_self ())
-	continue;
-
-      auto param = static_cast<AST::FunctionParam *> (p.get ());
-
-      auto translated_pattern = std::unique_ptr<HIR::Pattern> (
-	ASTLoweringPattern::translate (param->get_pattern ().get ()));
-      auto translated_type = std::unique_ptr<HIR::Type> (
-	ASTLoweringType::translate (param->get_type ().get ()));
-
-      auto crate_num = mappings->get_current_crate ();
-      Analysis::NodeMapping mapping (crate_num, param->get_node_id (),
-				     mappings->get_next_hir_id (crate_num),
-				     UNKNOWN_LOCAL_DEFID);
-
-      auto hir_param
-	= HIR::FunctionParam (mapping, std::move (translated_pattern),
-			      std::move (translated_type), param->get_locus ());
-      function_params.push_back (hir_param);
-    }
-
-  HIR::TraitFunctionDecl decl (ref.get_identifier (), std::move (qualifiers),
-			       std::move (generic_params),
-			       std::move (self_param),
-			       std::move (function_params),
-			       std::move (return_type),
-			       std::move (where_clause));
-
-  bool terminated = false;
-  std::unique_ptr<HIR::BlockExpr> block_expr
-    = method.has_definition () ? std::unique_ptr<HIR::BlockExpr> (
-	ASTLoweringBlock::translate (method.get_definition ().get (),
-				     &terminated))
-			       : nullptr;
-
-  auto crate_num = mappings->get_current_crate ();
-  Analysis::NodeMapping mapping (crate_num, method.get_node_id (),
-				 mappings->get_next_hir_id (crate_num),
-				 mappings->get_next_localdef_id (crate_num));
-
-  HIR::TraitItemFunc *trait_item
-    = new HIR::TraitItemFunc (mapping, std::move (decl), std::move (block_expr),
-			      method.get_outer_attrs (), method.get_locus ());
-  translated = trait_item;
-
-  // insert mappings for self
-  mappings->insert_hir_self_param (&self_param);
-  mappings->insert_location (self_param.get_mappings ().get_hirid (),
-			     self_param.get_locus ());
-
-  // add the mappings for the function params at the end
-  for (auto &param : trait_item->get_decl ().get_function_params ())
-    {
-      mappings->insert_hir_param (&param);
-      mappings->insert_location (mapping.get_hirid (), param.get_locus ());
-    }
-}
-
 void
 ASTLowerTraitItem::visit (AST::TraitItemConst &constant)
 {
diff --git a/gcc/rust/hir/rust-ast-lower-implitem.h b/gcc/rust/hir/rust-ast-lower-implitem.h
index b9d12cc4a56..bbde9f6878c 100644
--- a/gcc/rust/hir/rust-ast-lower-implitem.h
+++ b/gcc/rust/hir/rust-ast-lower-implitem.h
@@ -49,8 +49,6 @@  class ASTLowerTraitItem : public ASTLoweringBase
 public:
   static HIR::TraitItem *translate (AST::AssociatedItem *item);
   void visit (AST::Function &func) override;
-  void visit (AST::TraitItemFunc &func) override;
-  void visit (AST::TraitItemMethod &method) override;
   void visit (AST::TraitItemConst &constant) override;
   void visit (AST::TraitItemType &type) override;
 
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.cc b/gcc/rust/resolve/rust-ast-resolve-base.cc
index 1283d77d22b..c88bd58860a 100644
--- a/gcc/rust/resolve/rust-ast-resolve-base.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-base.cc
@@ -402,14 +402,6 @@  void
 ResolverBase::visit (AST::StaticItem &)
 {}
 
-void
-ResolverBase::visit (AST::TraitItemFunc &)
-{}
-
-void
-ResolverBase::visit (AST::TraitItemMethod &)
-{}
-
 void
 ResolverBase::visit (AST::TraitItemConst &)
 {}
diff --git a/gcc/rust/resolve/rust-ast-resolve-base.h b/gcc/rust/resolve/rust-ast-resolve-base.h
index 78830498771..9bc64331f5a 100644
--- a/gcc/rust/resolve/rust-ast-resolve-base.h
+++ b/gcc/rust/resolve/rust-ast-resolve-base.h
@@ -126,8 +126,6 @@  public:
   void visit (AST::Union &);
   void visit (AST::ConstantItem &);
   void visit (AST::StaticItem &);
-  void visit (AST::TraitItemFunc &);
-  void visit (AST::TraitItemMethod &);
   void visit (AST::TraitItemConst &);
   void visit (AST::TraitItemType &);
   void visit (AST::Trait &);
diff --git a/gcc/rust/resolve/rust-ast-resolve-implitem.h b/gcc/rust/resolve/rust-ast-resolve-implitem.h
index d9c9bcb28c9..fabc25817f5 100644
--- a/gcc/rust/resolve/rust-ast-resolve-implitem.h
+++ b/gcc/rust/resolve/rust-ast-resolve-implitem.h
@@ -130,46 +130,6 @@  public:
     mappings->insert_canonical_path (function.get_node_id (), cpath);
   }
 
-  void visit (AST::TraitItemFunc &function) override
-  {
-    auto decl = CanonicalPath::new_seg (
-      function.get_node_id (),
-      function.get_trait_function_decl ().get_identifier ().as_string ());
-    auto path = prefix.append (decl);
-    auto cpath = canonical_prefix.append (decl);
-
-    resolver->get_name_scope ().insert (
-      path, function.get_node_id (), function.get_locus (), false,
-      Rib::ItemType::Function,
-      [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
-	rich_location r (line_table, function.get_locus ());
-	r.add_range (locus);
-	rust_error_at (r, "redefined multiple times");
-      });
-
-    mappings->insert_canonical_path (function.get_node_id (), cpath);
-  }
-
-  void visit (AST::TraitItemMethod &method) override
-  {
-    auto decl = CanonicalPath::new_seg (
-      method.get_node_id (),
-      method.get_trait_method_decl ().get_identifier ().as_string ());
-    auto path = prefix.append (decl);
-    auto cpath = canonical_prefix.append (decl);
-
-    resolver->get_name_scope ().insert (
-      path, method.get_node_id (), method.get_locus (), false,
-      Rib::ItemType::Function,
-      [&] (const CanonicalPath &, NodeId, location_t locus) -> void {
-	rich_location r (line_table, method.get_locus ());
-	r.add_range (locus);
-	rust_error_at (r, "redefined multiple times");
-      });
-
-    mappings->insert_canonical_path (method.get_node_id (), cpath);
-  }
-
   void visit (AST::TraitItemConst &constant) override
   {
     auto decl
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.cc b/gcc/rust/resolve/rust-ast-resolve-item.cc
index 6037fe59f5b..e69b945407c 100644
--- a/gcc/rust/resolve/rust-ast-resolve-item.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-item.cc
@@ -146,161 +146,6 @@  ResolveTraitItems::visit (AST::TraitItemType &type)
     ResolveTypeBound::go (bound.get ());
 }
 
-void
-ResolveTraitItems::visit (AST::TraitItemFunc &func)
-{
-  auto decl = CanonicalPath::new_seg (
-    func.get_node_id (),
-    func.get_trait_function_decl ().get_identifier ().as_string ());
-  auto path = prefix.append (decl);
-  auto cpath = canonical_prefix.append (decl);
-  mappings->insert_canonical_path (func.get_node_id (), cpath);
-
-  NodeId scope_node_id = func.get_node_id ();
-  resolver->get_name_scope ().push (scope_node_id);
-  resolver->get_type_scope ().push (scope_node_id);
-  resolver->get_label_scope ().push (scope_node_id);
-  resolver->push_new_name_rib (resolver->get_name_scope ().peek ());
-  resolver->push_new_type_rib (resolver->get_type_scope ().peek ());
-  resolver->push_new_label_rib (resolver->get_type_scope ().peek ());
-
-  AST::TraitFunctionDecl &function = func.get_trait_function_decl ();
-  if (function.has_generics ())
-    for (auto &generic : function.get_generic_params ())
-      ResolveGenericParam::go (generic.get (), prefix, canonical_prefix);
-
-  if (function.has_return_type ())
-    ResolveType::go (function.get_return_type ().get ());
-
-  std::vector<PatternBinding> bindings
-    = {PatternBinding (PatternBoundCtx::Product, std::set<Identifier> ())};
-
-  // we make a new scope so the names of parameters are resolved and shadowed
-  // correctly
-  for (auto &p : function.get_function_params ())
-    {
-      if (p->is_variadic ())
-	{
-	  auto param = static_cast<AST::VariadicParam *> (p.get ());
-	  PatternDeclaration::go (param->get_pattern ().get (),
-				  Rib::ItemType::Param, bindings);
-	}
-      else if (p->is_self ())
-	{
-	  auto param = static_cast<AST::SelfParam *> (p.get ());
-	  ResolveType::go (param->get_type ().get ());
-	}
-      else
-	{
-	  auto param = static_cast<AST::FunctionParam *> (p.get ());
-	  ResolveType::go (param->get_type ().get ());
-	  PatternDeclaration::go (param->get_pattern ().get (),
-				  Rib::ItemType::Param, bindings);
-	}
-    }
-
-  if (function.has_where_clause ())
-    ResolveWhereClause::Resolve (function.get_where_clause ());
-
-  // trait items have an optional body
-  if (func.has_definition ())
-    ResolveExpr::go (func.get_definition ().get (), path, cpath);
-
-  resolver->get_name_scope ().pop ();
-  resolver->get_type_scope ().pop ();
-  resolver->get_label_scope ().pop ();
-}
-
-void
-ResolveTraitItems::visit (AST::TraitItemMethod &func)
-{
-  auto decl = CanonicalPath::new_seg (
-    func.get_node_id (),
-    func.get_trait_method_decl ().get_identifier ().as_string ());
-  auto path = prefix.append (decl);
-  auto cpath = canonical_prefix.append (decl);
-  mappings->insert_canonical_path (func.get_node_id (), cpath);
-
-  NodeId scope_node_id = func.get_node_id ();
-  resolver->get_name_scope ().push (scope_node_id);
-  resolver->get_type_scope ().push (scope_node_id);
-  resolver->get_label_scope ().push (scope_node_id);
-  resolver->push_new_name_rib (resolver->get_name_scope ().peek ());
-  resolver->push_new_type_rib (resolver->get_type_scope ().peek ());
-  resolver->push_new_label_rib (resolver->get_type_scope ().peek ());
-
-  AST::TraitMethodDecl &function = func.get_trait_method_decl ();
-  if (function.has_generics ())
-    for (auto &generic : function.get_generic_params ())
-      ResolveGenericParam::go (generic.get (), prefix, canonical_prefix);
-
-  if (function.has_return_type ())
-    ResolveType::go (function.get_return_type ().get ());
-
-  // self turns into (self: Self) as a function param
-  std::vector<PatternBinding> bindings
-    = {PatternBinding (PatternBoundCtx::Product, std::set<Identifier> ())};
-
-  // we make a new scope so the names of parameters are resolved and shadowed
-  // correctly
-  for (auto &p : function.get_function_params ())
-    {
-      if (p->is_variadic ())
-	{
-	  auto param = static_cast<AST::VariadicParam *> (p.get ());
-	  PatternDeclaration::go (param->get_pattern ().get (),
-				  Rib::ItemType::Param, bindings);
-	}
-      else if (p->is_self ())
-	{
-	  auto param = static_cast<AST::SelfParam *> (p.get ());
-	  // FIXME: which location should be used for Rust::Identifier `self`?
-	  AST::IdentifierPattern self_pattern (
-	    param->get_node_id (), {"self"}, param->get_locus (),
-	    param->get_has_ref (), param->get_is_mut (),
-	    std::unique_ptr<AST::Pattern> (nullptr));
-
-	  PatternDeclaration::go (&self_pattern, Rib::ItemType::Param);
-
-	  if (param->has_type ())
-	    {
-	      // This shouldn't happen the parser should already error for this
-	      rust_assert (!param->get_has_ref ());
-	      ResolveType::go (param->get_type ().get ());
-	    }
-	  else
-	    {
-	      // here we implicitly make self have a type path of Self
-	      std::vector<std::unique_ptr<AST::TypePathSegment>> segments;
-	      segments.push_back (std::unique_ptr<AST::TypePathSegment> (
-		new AST::TypePathSegment ("Self", false, param->get_locus ())));
-
-	      AST::TypePath self_type_path (std::move (segments),
-					    param->get_locus ());
-	      ResolveType::go (&self_type_path);
-	    }
-	}
-      else
-	{
-	  auto param = static_cast<AST::FunctionParam *> (p.get ());
-	  ResolveType::go (param->get_type ().get ());
-	  PatternDeclaration::go (param->get_pattern ().get (),
-				  Rib::ItemType::Param, bindings);
-	}
-    }
-
-  if (function.has_where_clause ())
-    ResolveWhereClause::Resolve (function.get_where_clause ());
-
-  // trait items have an optional body
-  if (func.has_definition ())
-    ResolveExpr::go (func.get_definition ().get (), path, cpath);
-
-  resolver->get_name_scope ().pop ();
-  resolver->get_type_scope ().pop ();
-  resolver->get_label_scope ().pop ();
-}
-
 void
 ResolveTraitItems::visit (AST::TraitItemConst &constant)
 {
diff --git a/gcc/rust/resolve/rust-ast-resolve-item.h b/gcc/rust/resolve/rust-ast-resolve-item.h
index 33a78e21957..0c7b7527c44 100644
--- a/gcc/rust/resolve/rust-ast-resolve-item.h
+++ b/gcc/rust/resolve/rust-ast-resolve-item.h
@@ -37,8 +37,6 @@  public:
 
   void visit (AST::Function &type) override;
   void visit (AST::TraitItemType &type) override;
-  void visit (AST::TraitItemFunc &func) override;
-  void visit (AST::TraitItemMethod &func) override;
   void visit (AST::TraitItemConst &constant) override;
 
 private:
diff --git a/gcc/rust/resolve/rust-default-resolver.cc b/gcc/rust/resolve/rust-default-resolver.cc
index ab4d5e8b70d..b1163535657 100644
--- a/gcc/rust/resolve/rust-default-resolver.cc
+++ b/gcc/rust/resolve/rust-default-resolver.cc
@@ -402,14 +402,6 @@  DefaultResolver::visit (AST::StaticItem &item)
   ctx.scoped (Rib::Kind::ConstantItem, item.get_node_id (), expr_vis);
 }
 
-void
-DefaultResolver::visit (AST::TraitItemFunc &)
-{}
-
-void
-DefaultResolver::visit (AST::TraitItemMethod &)
-{}
-
 void
 DefaultResolver::visit (AST::TraitItemConst &)
 {}
diff --git a/gcc/rust/resolve/rust-default-resolver.h b/gcc/rust/resolve/rust-default-resolver.h
index 20dbff8e110..d508ff3ac79 100644
--- a/gcc/rust/resolve/rust-default-resolver.h
+++ b/gcc/rust/resolve/rust-default-resolver.h
@@ -114,8 +114,6 @@  public:
   void visit (AST::EnumItemDiscriminant &);
   void visit (AST::ConstantItem &);
   void visit (AST::StaticItem &);
-  void visit (AST::TraitItemFunc &);
-  void visit (AST::TraitItemMethod &);
   void visit (AST::TraitItemConst &);
   void visit (AST::TraitItemType &);
   void visit (AST::ExternalTypeItem &);
diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
index 46113a8a46b..af7766d7b96 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc
@@ -228,16 +228,6 @@  TopLevel::visit (AST::StaticItem &static_item)
   ctx.scoped (Rib::Kind::Item, static_item.get_node_id (), sub_vis);
 }
 
-void
-TopLevel::visit (AST::TraitItemFunc &item)
-{
-  auto def_vis
-    = [this, &item] () { item.get_definition ()->accept_vis (*this); };
-
-  if (item.has_definition ())
-    ctx.scoped (Rib::Kind::Function, item.get_node_id (), def_vis);
-}
-
 void
 TopLevel::visit (AST::StructStruct &struct_item)
 {
diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h
index 996899b0848..f1943ee1398 100644
--- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h
+++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.h
@@ -65,7 +65,6 @@  private:
   void visit (AST::Function &function) override;
   void visit (AST::BlockExpr &expr) override;
   void visit (AST::StaticItem &static_item) override;
-  void visit (AST::TraitItemFunc &item) override;
   void visit (AST::StructStruct &struct_item) override;
   void visit (AST::TupleStruct &tuple_struct) override;
   void visit (AST::EnumItem &variant) override;
diff --git a/gcc/rust/util/rust-attributes.cc b/gcc/rust/util/rust-attributes.cc
index 3c296b565f5..715e9a0b361 100644
--- a/gcc/rust/util/rust-attributes.cc
+++ b/gcc/rust/util/rust-attributes.cc
@@ -730,14 +730,6 @@  AttributeChecker::visit (AST::StaticItem &item)
   check_proc_macro_non_function (item.get_outer_attrs ());
 }
 
-void
-AttributeChecker::visit (AST::TraitItemFunc &)
-{}
-
-void
-AttributeChecker::visit (AST::TraitItemMethod &)
-{}
-
 void
 AttributeChecker::visit (AST::TraitItemConst &)
 {}
diff --git a/gcc/rust/util/rust-attributes.h b/gcc/rust/util/rust-attributes.h
index eecc4c0050b..d78ab0b3319 100644
--- a/gcc/rust/util/rust-attributes.h
+++ b/gcc/rust/util/rust-attributes.h
@@ -192,8 +192,6 @@  private:
   void visit (AST::Union &union_item) override;
   void visit (AST::ConstantItem &const_item) override;
   void visit (AST::StaticItem &static_item) override;
-  void visit (AST::TraitItemFunc &item) override;
-  void visit (AST::TraitItemMethod &item) override;
   void visit (AST::TraitItemConst &item) override;
   void visit (AST::TraitItemType &item) override;
   void visit (AST::Trait &trait) override;