public inbox for gcc-rust@gcc.gnu.org
 help / color / mirror / Atom feed
From: arthur.cohen@embecosm.com
To: gcc-patches@gcc.gnu.org
Cc: gcc-rust@gcc.gnu.org, Philip Herron <herron.philip@googlemail.com>
Subject: [committed 39/88] gccrs: Refactor all substitution mapper code implementation into its own CC file
Date: Wed,  5 Apr 2023 16:03:23 +0200	[thread overview]
Message-ID: <20230405140411.3016563-40-arthur.cohen@embecosm.com> (raw)
In-Reply-To: <20230405140411.3016563-1-arthur.cohen@embecosm.com>

From: Philip Herron <herron.philip@googlemail.com>

Signed-off-by: Philip Herron <herron.philip@googlemail.com>

gcc/rust/ChangeLog:

	* typecheck/rust-substitution-mapper.cc (SubstMapper::SubstMapper): refactor
	(SubstMapper::Resolve): likewise
	(SubstMapper::InferSubst): likewise
	(SubstMapper::have_generic_args): likewise
	(SubstMapper::visit): likewise
	(SubstMapperInternal::visit): likewise
	(SubstMapperFromExisting::SubstMapperFromExisting): likewise
	(SubstMapperFromExisting::Resolve): likewise
	(SubstMapperFromExisting::visit): likewise
	(GetUsedSubstArgs::GetUsedSubstArgs): likewise
	(GetUsedSubstArgs::From): likewise
	(GetUsedSubstArgs::visit): likewise
	* typecheck/rust-substitution-mapper.h: refactor
	* typecheck/rust-tyty-subst.cc (SubstitutionParamMapping::get_generic_param): likewise
---
 .../typecheck/rust-substitution-mapper.cc     | 343 ++++++++++++++++++
 gcc/rust/typecheck/rust-substitution-mapper.h | 286 +++------------
 gcc/rust/typecheck/rust-tyty-subst.cc         |   2 +-
 3 files changed, 387 insertions(+), 244 deletions(-)

diff --git a/gcc/rust/typecheck/rust-substitution-mapper.cc b/gcc/rust/typecheck/rust-substitution-mapper.cc
index e1d988818bb..dc93857e60f 100644
--- a/gcc/rust/typecheck/rust-substitution-mapper.cc
+++ b/gcc/rust/typecheck/rust-substitution-mapper.cc
@@ -22,6 +22,116 @@
 namespace Rust {
 namespace Resolver {
 
+SubstMapper::SubstMapper (HirId ref, HIR::GenericArgs *generics, Location locus)
+  : resolved (new TyTy::ErrorType (ref)), generics (generics), locus (locus)
+{}
+
+TyTy::BaseType *
+SubstMapper::Resolve (TyTy::BaseType *base, Location locus,
+		      HIR::GenericArgs *generics)
+{
+  SubstMapper mapper (base->get_ref (), generics, locus);
+  base->accept_vis (mapper);
+  rust_assert (mapper.resolved != nullptr);
+  return mapper.resolved;
+}
+
+TyTy::BaseType *
+SubstMapper::InferSubst (TyTy::BaseType *base, Location locus)
+{
+  return SubstMapper::Resolve (base, locus, nullptr);
+}
+
+bool
+SubstMapper::have_generic_args () const
+{
+  return generics != nullptr;
+}
+
+void
+SubstMapper::visit (TyTy::FnType &type)
+{
+  TyTy::FnType *concrete = nullptr;
+  if (!have_generic_args ())
+    {
+      TyTy::BaseType *substs = type.infer_substitions (locus);
+      rust_assert (substs->get_kind () == TyTy::TypeKind::FNDEF);
+      concrete = static_cast<TyTy::FnType *> (substs);
+    }
+  else
+    {
+      TyTy::SubstitutionArgumentMappings mappings
+	= type.get_mappings_from_generic_args (*generics);
+      if (mappings.is_error ())
+	return;
+
+      concrete = type.handle_substitions (mappings);
+    }
+
+  if (concrete != nullptr)
+    resolved = concrete;
+}
+
+void
+SubstMapper::visit (TyTy::ADTType &type)
+{
+  TyTy::ADTType *concrete = nullptr;
+  if (!have_generic_args ())
+    {
+      TyTy::BaseType *substs = type.infer_substitions (locus);
+      rust_assert (substs->get_kind () == TyTy::TypeKind::ADT);
+      concrete = static_cast<TyTy::ADTType *> (substs);
+    }
+  else
+    {
+      TyTy::SubstitutionArgumentMappings mappings
+	= type.get_mappings_from_generic_args (*generics);
+      if (mappings.is_error ())
+	return;
+
+      concrete = type.handle_substitions (mappings);
+    }
+
+  if (concrete != nullptr)
+    resolved = concrete;
+}
+
+void
+SubstMapper::visit (TyTy::PlaceholderType &type)
+{
+  rust_assert (type.can_resolve ());
+  resolved = SubstMapper::Resolve (type.resolve (), locus, generics);
+}
+
+void
+SubstMapper::visit (TyTy::ProjectionType &type)
+{
+  TyTy::ProjectionType *concrete = nullptr;
+  if (!have_generic_args ())
+    {
+      TyTy::BaseType *substs = type.infer_substitions (locus);
+      rust_assert (substs->get_kind () == TyTy::TypeKind::PROJECTION);
+      concrete = static_cast<TyTy::ProjectionType *> (substs);
+    }
+  else
+    {
+      TyTy::SubstitutionArgumentMappings mappings
+	= type.get_mappings_from_generic_args (*generics);
+      if (mappings.is_error ())
+	return;
+
+      concrete = type.handle_substitions (mappings);
+    }
+
+  if (concrete != nullptr)
+    resolved = concrete;
+}
+
+SubstMapperInternal::SubstMapperInternal (
+  HirId ref, TyTy::SubstitutionArgumentMappings &mappings)
+  : resolved (new TyTy::ErrorType (ref)), mappings (mappings)
+{}
+
 TyTy::BaseType *
 SubstMapperInternal::Resolve (TyTy::BaseType *base,
 			      TyTy::SubstitutionArgumentMappings &mappings)
@@ -73,5 +183,238 @@ SubstMapperInternal::mappings_are_bound (
   return false;
 }
 
+void
+SubstMapperInternal::visit (TyTy::FnType &type)
+{
+  TyTy::SubstitutionArgumentMappings adjusted
+    = type.adjust_mappings_for_this (mappings);
+  if (adjusted.is_error ())
+    return;
+
+  TyTy::BaseType *concrete = type.handle_substitions (adjusted);
+  if (concrete != nullptr)
+    resolved = concrete;
+}
+
+void
+SubstMapperInternal::visit (TyTy::ADTType &type)
+{
+  TyTy::SubstitutionArgumentMappings adjusted
+    = type.adjust_mappings_for_this (mappings);
+  if (adjusted.is_error ())
+    return;
+
+  TyTy::BaseType *concrete = type.handle_substitions (adjusted);
+  if (concrete != nullptr)
+    resolved = concrete;
+}
+
+// these don't support generic arguments but might contain a type param
+void
+SubstMapperInternal::visit (TyTy::TupleType &type)
+{
+  resolved = type.handle_substitions (mappings);
+}
+
+void
+SubstMapperInternal::visit (TyTy::ReferenceType &type)
+{
+  resolved = type.handle_substitions (mappings);
+}
+
+void
+SubstMapperInternal::visit (TyTy::PointerType &type)
+{
+  resolved = type.handle_substitions (mappings);
+}
+
+void
+SubstMapperInternal::visit (TyTy::ParamType &type)
+{
+  resolved = type.handle_substitions (mappings);
+}
+
+void
+SubstMapperInternal::visit (TyTy::PlaceholderType &type)
+{
+  rust_assert (type.can_resolve ());
+  if (mappings.trait_item_mode ())
+    {
+      resolved = type.resolve ();
+    }
+  else
+    {
+      resolved = SubstMapperInternal::Resolve (type.resolve (), mappings);
+    }
+}
+
+void
+SubstMapperInternal::visit (TyTy::ProjectionType &type)
+{
+  resolved = type.handle_substitions (mappings);
+}
+
+void
+SubstMapperInternal::visit (TyTy::ClosureType &type)
+{
+  resolved = type.handle_substitions (mappings);
+}
+
+void
+SubstMapperInternal::visit (TyTy::ArrayType &type)
+{
+  resolved = type.handle_substitions (mappings);
+}
+
+void
+SubstMapperInternal::visit (TyTy::SliceType &type)
+{
+  resolved = type.handle_substitions (mappings);
+}
+
+// nothing to do for these
+void
+SubstMapperInternal::visit (TyTy::InferType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::FnPtr &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::BoolType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::IntType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::UintType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::FloatType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::USizeType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::ISizeType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::ErrorType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::CharType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::StrType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::NeverType &type)
+{
+  resolved = type.clone ();
+}
+void
+SubstMapperInternal::visit (TyTy::DynamicObjectType &type)
+{
+  resolved = type.clone ();
+}
+
+// SubstMapperFromExisting
+
+SubstMapperFromExisting::SubstMapperFromExisting (TyTy::BaseType *concrete,
+						  TyTy::BaseType *receiver)
+  : concrete (concrete), receiver (receiver), resolved (nullptr)
+{}
+
+TyTy::BaseType *
+SubstMapperFromExisting::Resolve (TyTy::BaseType *concrete,
+				  TyTy::BaseType *receiver)
+{
+  rust_assert (concrete->get_kind () == receiver->get_kind ());
+
+  SubstMapperFromExisting mapper (concrete, receiver);
+  concrete->accept_vis (mapper);
+  return mapper.resolved;
+}
+
+void
+SubstMapperFromExisting::visit (TyTy::FnType &type)
+{
+  rust_assert (type.was_substituted ());
+
+  TyTy::FnType *to_sub = static_cast<TyTy::FnType *> (receiver);
+  resolved = to_sub->handle_substitions (type.get_substitution_arguments ());
+}
+
+void
+SubstMapperFromExisting::visit (TyTy::ADTType &type)
+{
+  rust_assert (type.was_substituted ());
+
+  TyTy::ADTType *to_sub = static_cast<TyTy::ADTType *> (receiver);
+  resolved = to_sub->handle_substitions (type.get_substitution_arguments ());
+}
+
+void
+SubstMapperFromExisting::visit (TyTy::ClosureType &type)
+{
+  rust_assert (type.was_substituted ());
+
+  TyTy::ClosureType *to_sub = static_cast<TyTy::ClosureType *> (receiver);
+  resolved = to_sub->handle_substitions (type.get_substitution_arguments ());
+}
+
+// GetUsedSubstArgs
+
+GetUsedSubstArgs::GetUsedSubstArgs ()
+  : args (TyTy::SubstitutionArgumentMappings::error ())
+{}
+
+TyTy::SubstitutionArgumentMappings
+GetUsedSubstArgs::From (const TyTy::BaseType *from)
+{
+  GetUsedSubstArgs mapper;
+  from->accept_vis (mapper);
+  return mapper.args;
+}
+
+void
+GetUsedSubstArgs::visit (const TyTy::FnType &type)
+{
+  args = type.get_substitution_arguments ();
+}
+
+void
+GetUsedSubstArgs::visit (const TyTy::ADTType &type)
+{
+  args = type.get_substitution_arguments ();
+}
+
+void
+GetUsedSubstArgs::visit (const TyTy::ClosureType &type)
+{
+  args = type.get_substitution_arguments ();
+}
+
 } // namespace Resolver
 } // namespace Rust
diff --git a/gcc/rust/typecheck/rust-substitution-mapper.h b/gcc/rust/typecheck/rust-substitution-mapper.h
index 995d9c88ec4..43b80b36713 100644
--- a/gcc/rust/typecheck/rust-substitution-mapper.h
+++ b/gcc/rust/typecheck/rust-substitution-mapper.h
@@ -29,95 +29,16 @@ class SubstMapper : public TyTy::TyVisitor
 {
 public:
   static TyTy::BaseType *Resolve (TyTy::BaseType *base, Location locus,
-				  HIR::GenericArgs *generics = nullptr)
-  {
-    SubstMapper mapper (base->get_ref (), generics, locus);
-    base->accept_vis (mapper);
-    rust_assert (mapper.resolved != nullptr);
-    return mapper.resolved;
-  }
+				  HIR::GenericArgs *generics = nullptr);
 
-  static TyTy::BaseType *InferSubst (TyTy::BaseType *base, Location locus)
-  {
-    return SubstMapper::Resolve (base, locus, nullptr);
-  }
+  static TyTy::BaseType *InferSubst (TyTy::BaseType *base, Location locus);
 
-  bool have_generic_args () const { return generics != nullptr; }
+  bool have_generic_args () const;
 
-  void visit (TyTy::FnType &type) override
-  {
-    TyTy::FnType *concrete = nullptr;
-    if (!have_generic_args ())
-      {
-	TyTy::BaseType *substs = type.infer_substitions (locus);
-	rust_assert (substs->get_kind () == TyTy::TypeKind::FNDEF);
-	concrete = static_cast<TyTy::FnType *> (substs);
-      }
-    else
-      {
-	TyTy::SubstitutionArgumentMappings mappings
-	  = type.get_mappings_from_generic_args (*generics);
-	if (mappings.is_error ())
-	  return;
-
-	concrete = type.handle_substitions (mappings);
-      }
-
-    if (concrete != nullptr)
-      resolved = concrete;
-  }
-
-  void visit (TyTy::ADTType &type) override
-  {
-    TyTy::ADTType *concrete = nullptr;
-    if (!have_generic_args ())
-      {
-	TyTy::BaseType *substs = type.infer_substitions (locus);
-	rust_assert (substs->get_kind () == TyTy::TypeKind::ADT);
-	concrete = static_cast<TyTy::ADTType *> (substs);
-      }
-    else
-      {
-	TyTy::SubstitutionArgumentMappings mappings
-	  = type.get_mappings_from_generic_args (*generics);
-	if (mappings.is_error ())
-	  return;
-
-	concrete = type.handle_substitions (mappings);
-      }
-
-    if (concrete != nullptr)
-      resolved = concrete;
-  }
-
-  void visit (TyTy::PlaceholderType &type) override
-  {
-    rust_assert (type.can_resolve ());
-    resolved = SubstMapper::Resolve (type.resolve (), locus, generics);
-  }
-
-  void visit (TyTy::ProjectionType &type) override
-  {
-    TyTy::ProjectionType *concrete = nullptr;
-    if (!have_generic_args ())
-      {
-	TyTy::BaseType *substs = type.infer_substitions (locus);
-	rust_assert (substs->get_kind () == TyTy::TypeKind::PROJECTION);
-	concrete = static_cast<TyTy::ProjectionType *> (substs);
-      }
-    else
-      {
-	TyTy::SubstitutionArgumentMappings mappings
-	  = type.get_mappings_from_generic_args (*generics);
-	if (mappings.is_error ())
-	  return;
-
-	concrete = type.handle_substitions (mappings);
-      }
-
-    if (concrete != nullptr)
-      resolved = concrete;
-  }
+  void visit (TyTy::FnType &type) override;
+  void visit (TyTy::ADTType &type) override;
+  void visit (TyTy::PlaceholderType &type) override;
+  void visit (TyTy::ProjectionType &type) override;
 
   // nothing to do for these
   void visit (TyTy::InferType &) override { gcc_unreachable (); }
@@ -142,9 +63,7 @@ public:
   void visit (TyTy::ClosureType &) override { gcc_unreachable (); }
 
 private:
-  SubstMapper (HirId ref, HIR::GenericArgs *generics, Location locus)
-    : resolved (new TyTy::ErrorType (ref)), generics (generics), locus (locus)
-  {}
+  SubstMapper (HirId ref, HIR::GenericArgs *generics, Location locus);
 
   TyTy::BaseType *resolved;
   HIR::GenericArgs *generics;
@@ -160,106 +79,33 @@ public:
   static bool mappings_are_bound (TyTy::BaseType *ty,
 				  TyTy::SubstitutionArgumentMappings &mappings);
 
-  void visit (TyTy::FnType &type) override
-  {
-    TyTy::SubstitutionArgumentMappings adjusted
-      = type.adjust_mappings_for_this (mappings);
-    if (adjusted.is_error ())
-      return;
-
-    TyTy::BaseType *concrete = type.handle_substitions (adjusted);
-    if (concrete != nullptr)
-      resolved = concrete;
-  }
-
-  void visit (TyTy::ADTType &type) override
-  {
-    TyTy::SubstitutionArgumentMappings adjusted
-      = type.adjust_mappings_for_this (mappings);
-    if (adjusted.is_error ())
-      return;
-
-    TyTy::BaseType *concrete = type.handle_substitions (adjusted);
-    if (concrete != nullptr)
-      resolved = concrete;
-  }
-
-  // these don't support generic arguments but might contain a type param
-  void visit (TyTy::TupleType &type) override
-  {
-    resolved = type.handle_substitions (mappings);
-  }
-
-  void visit (TyTy::ReferenceType &type) override
-  {
-    resolved = type.handle_substitions (mappings);
-  }
-
-  void visit (TyTy::PointerType &type) override
-  {
-    resolved = type.handle_substitions (mappings);
-  }
-
-  void visit (TyTy::ParamType &type) override
-  {
-    resolved = type.handle_substitions (mappings);
-  }
-
-  void visit (TyTy::PlaceholderType &type) override
-  {
-    rust_assert (type.can_resolve ());
-    if (mappings.trait_item_mode ())
-      {
-	resolved = type.resolve ();
-      }
-    else
-      {
-	resolved = SubstMapperInternal::Resolve (type.resolve (), mappings);
-      }
-  }
-
-  void visit (TyTy::ProjectionType &type) override
-  {
-    resolved = type.handle_substitions (mappings);
-  }
-
-  void visit (TyTy::ClosureType &type) override
-  {
-    resolved = type.handle_substitions (mappings);
-  }
-
-  void visit (TyTy::ArrayType &type) override
-  {
-    resolved = type.handle_substitions (mappings);
-  }
-
-  void visit (TyTy::SliceType &type) override
-  {
-    resolved = type.handle_substitions (mappings);
-  }
-
-  // nothing to do for these
-  void visit (TyTy::InferType &type) override { resolved = type.clone (); }
-  void visit (TyTy::FnPtr &type) override { resolved = type.clone (); }
-  void visit (TyTy::BoolType &type) override { resolved = type.clone (); }
-  void visit (TyTy::IntType &type) override { resolved = type.clone (); }
-  void visit (TyTy::UintType &type) override { resolved = type.clone (); }
-  void visit (TyTy::FloatType &type) override { resolved = type.clone (); }
-  void visit (TyTy::USizeType &type) override { resolved = type.clone (); }
-  void visit (TyTy::ISizeType &type) override { resolved = type.clone (); }
-  void visit (TyTy::ErrorType &type) override { resolved = type.clone (); }
-  void visit (TyTy::CharType &type) override { resolved = type.clone (); }
-  void visit (TyTy::StrType &type) override { resolved = type.clone (); }
-  void visit (TyTy::NeverType &type) override { resolved = type.clone (); }
-  void visit (TyTy::DynamicObjectType &type) override
-  {
-    resolved = type.clone ();
-  }
+  void visit (TyTy::FnType &type) override;
+  void visit (TyTy::ADTType &type) override;
+  void visit (TyTy::TupleType &type) override;
+  void visit (TyTy::ReferenceType &type) override;
+  void visit (TyTy::PointerType &type) override;
+  void visit (TyTy::ParamType &type) override;
+  void visit (TyTy::PlaceholderType &type) override;
+  void visit (TyTy::ProjectionType &type) override;
+  void visit (TyTy::ClosureType &type) override;
+  void visit (TyTy::ArrayType &type) override;
+  void visit (TyTy::SliceType &type) override;
+  void visit (TyTy::InferType &type) override;
+  void visit (TyTy::FnPtr &type) override;
+  void visit (TyTy::BoolType &type) override;
+  void visit (TyTy::IntType &type) override;
+  void visit (TyTy::UintType &type) override;
+  void visit (TyTy::FloatType &type) override;
+  void visit (TyTy::USizeType &type) override;
+  void visit (TyTy::ISizeType &type) override;
+  void visit (TyTy::ErrorType &type) override;
+  void visit (TyTy::CharType &type) override;
+  void visit (TyTy::StrType &type) override;
+  void visit (TyTy::NeverType &type) override;
+  void visit (TyTy::DynamicObjectType &type) override;
 
 private:
-  SubstMapperInternal (HirId ref, TyTy::SubstitutionArgumentMappings &mappings)
-    : resolved (new TyTy::ErrorType (ref)), mappings (mappings)
-  {}
+  SubstMapperInternal (HirId ref, TyTy::SubstitutionArgumentMappings &mappings);
 
   TyTy::BaseType *resolved;
   TyTy::SubstitutionArgumentMappings &mappings;
@@ -269,38 +115,11 @@ class SubstMapperFromExisting : public TyTy::TyVisitor
 {
 public:
   static TyTy::BaseType *Resolve (TyTy::BaseType *concrete,
-				  TyTy::BaseType *receiver)
-  {
-    rust_assert (concrete->get_kind () == receiver->get_kind ());
-
-    SubstMapperFromExisting mapper (concrete, receiver);
-    concrete->accept_vis (mapper);
-    return mapper.resolved;
-  }
+				  TyTy::BaseType *receiver);
 
-  void visit (TyTy::FnType &type) override
-  {
-    rust_assert (type.was_substituted ());
-
-    TyTy::FnType *to_sub = static_cast<TyTy::FnType *> (receiver);
-    resolved = to_sub->handle_substitions (type.get_substitution_arguments ());
-  }
-
-  void visit (TyTy::ADTType &type) override
-  {
-    rust_assert (type.was_substituted ());
-
-    TyTy::ADTType *to_sub = static_cast<TyTy::ADTType *> (receiver);
-    resolved = to_sub->handle_substitions (type.get_substitution_arguments ());
-  }
-
-  void visit (TyTy::ClosureType &type) override
-  {
-    rust_assert (type.was_substituted ());
-
-    TyTy::ClosureType *to_sub = static_cast<TyTy::ClosureType *> (receiver);
-    resolved = to_sub->handle_substitions (type.get_substitution_arguments ());
-  }
+  void visit (TyTy::FnType &type) override;
+  void visit (TyTy::ADTType &type) override;
+  void visit (TyTy::ClosureType &type) override;
 
   void visit (TyTy::InferType &) override { gcc_unreachable (); }
   void visit (TyTy::TupleType &) override { gcc_unreachable (); }
@@ -325,40 +144,21 @@ public:
   void visit (TyTy::DynamicObjectType &) override { gcc_unreachable (); }
 
 private:
-  SubstMapperFromExisting (TyTy::BaseType *concrete, TyTy::BaseType *receiver)
-    : concrete (concrete), receiver (receiver), resolved (nullptr)
-  {}
+  SubstMapperFromExisting (TyTy::BaseType *concrete, TyTy::BaseType *receiver);
 
   TyTy::BaseType *concrete;
   TyTy::BaseType *receiver;
-
   TyTy::BaseType *resolved;
 };
 
 class GetUsedSubstArgs : public TyTy::TyConstVisitor
 {
 public:
-  static TyTy::SubstitutionArgumentMappings From (const TyTy::BaseType *from)
-  {
-    GetUsedSubstArgs mapper;
-    from->accept_vis (mapper);
-    return mapper.args;
-  }
-
-  void visit (const TyTy::FnType &type) override
-  {
-    args = type.get_substitution_arguments ();
-  }
-
-  void visit (const TyTy::ADTType &type) override
-  {
-    args = type.get_substitution_arguments ();
-  }
+  static TyTy::SubstitutionArgumentMappings From (const TyTy::BaseType *from);
 
-  void visit (const TyTy::ClosureType &type) override
-  {
-    args = type.get_substitution_arguments ();
-  }
+  void visit (const TyTy::FnType &type) override;
+  void visit (const TyTy::ADTType &type) override;
+  void visit (const TyTy::ClosureType &type) override;
 
   void visit (const TyTy::InferType &) override {}
   void visit (const TyTy::TupleType &) override {}
@@ -383,7 +183,7 @@ public:
   void visit (const TyTy::DynamicObjectType &) override {}
 
 private:
-  GetUsedSubstArgs () : args (TyTy::SubstitutionArgumentMappings::error ()) {}
+  GetUsedSubstArgs ();
 
   TyTy::SubstitutionArgumentMappings args;
 };
diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc b/gcc/rust/typecheck/rust-tyty-subst.cc
index 64001459b4d..aceed29ff03 100644
--- a/gcc/rust/typecheck/rust-tyty-subst.cc
+++ b/gcc/rust/typecheck/rust-tyty-subst.cc
@@ -68,7 +68,7 @@ const HIR::TypeParam &
 SubstitutionParamMapping::get_generic_param ()
 {
   return generic;
-};
+}
 
 bool
 SubstitutionParamMapping::needs_substitution () const
-- 
2.40.0


  parent reply	other threads:[~2023-04-05 14:05 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 14:02 Rust front-end update 2023-04-05 arthur.cohen
2023-04-05 14:02 ` [committed 01/88] gccrs: fatal_error_flag: Fix typo in error message arthur.cohen
2023-04-05 14:02 ` [committed 02/88] gccrs: unsafe: check use of `target_feature` attribute arthur.cohen
2023-04-05 14:02 ` [committed 03/88] gccrs: Check for mutable references in const functions arthur.cohen
2023-04-05 14:02 ` [committed 04/88] gccrs: rust: add bound parsing in parse_generic_arg arthur.cohen
2023-04-05 14:02 ` [committed 05/88] gccrs: Implement declarative macro 2.0 parser arthur.cohen
2023-04-05 14:02 ` [committed 06/88] gccrs: Add name resolution to generic argument associated item bindings arthur.cohen
2023-04-05 14:02 ` [committed 07/88] gccrs: Support associated type bound arguments arthur.cohen
2023-04-05 14:02 ` [committed 08/88] gccrs: Reuse TypeCheckPattern on LetStmt's arthur.cohen
2023-04-05 14:02 ` [committed 09/88] gccrs: Add get_locus function for abstract class MetaItemInner arthur.cohen
2023-04-05 14:02 ` [committed 10/88] gccrs: diagnostics: Add underline for tokens in diagnostics arthur.cohen
2023-04-05 14:02 ` [committed 11/88] gccrs: Change how CompileVarDecl outputs Bvariable's arthur.cohen
2023-04-05 14:02 ` [committed 12/88] gccrs: testsuite: Handle Windows carriage returns properly arthur.cohen
2023-04-05 14:02 ` [committed 13/88] gccrs: Support GroupedPattern during name resolution arthur.cohen
2023-04-05 14:02 ` [committed 14/88] gccrs: Do not crash on empty macros expand. Fixes #1712 arthur.cohen
2023-04-05 14:02 ` [committed 15/88] gccrs: Add HIR lowering for GroupedPattern arthur.cohen
2023-04-05 14:03 ` [committed 16/88] gccrs: Add get_item method for HIR::GroupedPattern arthur.cohen
2023-04-05 14:03 ` [committed 17/88] gccrs: Add type resolution for grouped patterns arthur.cohen
2023-04-05 14:03 ` [committed 18/88] gccrs: Added missing GroupedPattern visitors for code generation arthur.cohen
2023-04-05 14:03 ` [committed 19/88] gccrs: Rename file rust-ast-full-test.cc to rust-ast.cc arthur.cohen
2023-04-05 14:03 ` [committed 20/88] gccrs: moved operator.h to util/rust-operators.h arthur.cohen
2023-04-05 14:03 ` [committed 21/88] gccrs: fixed compiler error message on wildcard pattern within expression arthur.cohen
2023-04-05 14:03 ` [committed 22/88] gccrs: fixed indentations in AST pretty expanded dump of trait arthur.cohen
2023-04-05 14:03 ` [committed 23/88] gccrs: macro: Allow builtin `MacroInvocation`s within the AST arthur.cohen
2023-04-05 14:03 ` [committed 24/88] gccrs: Create and use CompilePatternLet visitor for compiling let statments arthur.cohen
2023-04-05 14:03 ` [committed 25/88] gccrs: parser: Allow parsing multiple reference types arthur.cohen
2023-04-05 14:03 ` [committed 26/88] gccrs: Move rust-buffered-queue.h to util folder #1766 arthur.cohen
2023-04-05 14:03 ` [committed 27/88] gccrs: Improve GroupedPattern lowering arthur.cohen
2023-04-05 14:03 ` [committed 28/88] gccrs: Remove HIR::GroupedPattern arthur.cohen
2023-04-05 14:03 ` [committed 29/88] gccrs: Optimize HIR::ReferencePattern arthur.cohen
2023-04-05 14:03 ` [committed 30/88] gccrs: Implement lowering ReferencePattern from AST to HIR arthur.cohen
2023-04-05 14:03 ` [committed 31/88] gccrs: parser: Improve parsing of complex generic arguments arthur.cohen
2023-04-05 14:03 ` [committed 32/88] gccrs: parser: Fix parsing of closure param list arthur.cohen
2023-04-05 14:03 ` [committed 33/88] gccrs: Add support for feature check arthur.cohen
2023-04-05 14:03 ` [committed 34/88] gccrs: Removed comment copy-pasted from gcc/tree.def arthur.cohen
2023-04-05 14:03 ` [committed 35/88] gccrs: Add another test case for passing associated type-bounds arthur.cohen
2023-04-05 14:03 ` [committed 36/88] gccrs: Move TypePredicateItem impl out of the header arthur.cohen
2023-04-05 14:03 ` [committed 37/88] gccrs: Refactor TyVar and TypeBoundPredicates arthur.cohen
2023-04-05 14:03 ` [committed 38/88] gccrs: Refactor SubstitutionRef base class into its own CC file arthur.cohen
2023-04-05 14:03 ` arthur.cohen [this message]
2023-04-05 14:03 ` [committed 40/88] gccrs: Refactor BaseType, InferType and ErrorType impl into cc file arthur.cohen
2023-04-05 14:03 ` [committed 41/88] gccrs: Refactor PathProbe " arthur.cohen
2023-04-05 14:03 ` [committed 42/88] gccrs: Refactor PathProbeType code into CC file arthur.cohen
2023-04-05 14:03 ` [committed 43/88] gccrs: Refactor all code out of the rust-tyty.h header arthur.cohen
2023-04-05 14:03 ` [committed 44/88] gccrs: Rename rust-tyctx.cc to rust-typecheck-context.cc arthur.cohen
2023-04-05 14:03 ` [committed 45/88] gccrs: Rename header rust-hir-trait-ref.h to rust-hir-trait-reference.h arthur.cohen
2023-04-05 14:03 ` [committed 46/88] gccrs: Refactor handle_substitutions to take a reference arthur.cohen
2023-04-05 14:03 ` [committed 47/88] gccrs: Clear the substitution callbacks when copying ArgumentMappings arthur.cohen
2023-04-05 14:03 ` [committed 48/88] gccrs: Add missing param subst callback arthur.cohen
2023-04-05 14:03 ` [committed 49/88] gccrs: Remove monomorphization hack to setup possible associated types arthur.cohen
2023-04-05 14:03 ` [committed 50/88] gccrs: Refactor the type unification code arthur.cohen
2023-04-05 14:03 ` [committed 51/88] gccrs: Fix nullptr dereference arthur.cohen
2023-04-05 14:03 ` [committed 52/88] gccrs: Add missing Sized, Copy and Clone lang item mappings arthur.cohen
2023-04-05 14:03 ` [committed 53/88] gccrs: Fix higher ranked trait bounds computation of self arthur.cohen
2023-04-05 14:03 ` [committed 54/88] gccrs: Remove bad error message on checking function arguments arthur.cohen
2023-04-05 14:03 ` [committed 55/88] gccrs: Add general TypeBounds checks arthur.cohen
2023-04-05 14:03 ` [committed 56/88] gccrs: Add support for TuplePattern in let statements arthur.cohen
2023-04-05 14:03 ` [committed 57/88] gccrs: rust-item: include rust-expr.h arthur.cohen
2023-04-05 14:03 ` [committed 58/88] gccrs: parser: Expose parse_macro_invocation as public API arthur.cohen
2023-04-05 14:03 ` [committed 59/88] gccrs: expansion: Add `get_token_slice` to `MacroInvocLexer` class arthur.cohen
2023-04-05 14:03 ` [committed 60/88] gccrs: macros: Perform macro expansion in a fixed-point fashion arthur.cohen
2023-04-05 14:03 ` [committed 61/88] gccrs: expander: Add documentation for `expand_eager_invocations` arthur.cohen
2023-04-05 14:03 ` [committed 62/88] gccrs: typecheck: Refactor rust-hir-trait-reference.h arthur.cohen
2023-04-05 14:03 ` [committed 63/88] gccrs: cli: Update safety warning message arthur.cohen
2023-04-05 14:03 ` [committed 64/88] gccrs: Update copyright years arthur.cohen
2023-04-05 14:03 ` [committed 65/88] gccrs: Add feature gate for "rust-intrinsic" arthur.cohen
2023-04-05 14:03 ` [committed 66/88] gccrs: Add variadic argument type checking arthur.cohen
2023-04-05 14:03 ` [committed 67/88] gccrs: Add test arthur.cohen
2023-04-05 14:03 ` [committed 68/88] gccrs: Simplify WildcardPattern let statement handling arthur.cohen
2023-04-05 14:03 ` [committed 69/88] gccrs: lex: Prevent directories in RAIIFile arthur.cohen
2023-04-05 14:03 ` [committed 70/88] gccrs: testsuite: Add empty string macro test arthur.cohen
2023-04-05 14:03 ` [committed 71/88] gccrs: Add support for parsing empty tuple patterns arthur.cohen
2023-04-05 14:03 ` [committed 72/88] gccrs: Implemented UTF-8 checking for include_str!() arthur.cohen
2023-04-05 14:03 ` [committed 73/88] gccrs: Extract query_type from TypeCheckBase to be a simple extern arthur.cohen
2023-04-05 14:03 ` [committed 74/88] gccrs: Add new virtual function HIR::ImplItem::get_impl_item_name arthur.cohen
2023-04-05 14:03 ` [committed 75/88] gccrs: Support for Sized builtin marker trait arthur.cohen
2023-04-05 14:04 ` [committed 76/88] gccrs: Fix regression in testcase arthur.cohen
2023-04-05 14:04 ` [committed 77/88] gccrs: Add trailing newline arthur.cohen
2023-04-05 14:04 ` [committed 78/88] gccrs: builtins: Return empty list of tokens instead of nullptr arthur.cohen
2023-04-05 14:04 ` [committed 79/88] gccrs: Fix formatting arthur.cohen
2023-04-05 14:04 ` [committed 80/88] gccrs: Add AST::AltPattern class arthur.cohen
2023-04-05 14:04 ` [committed 81/88] gccrs: Fix up DejaGnu directives in 'rust/compile/issue-1830_{bytes,str}.rs' test cases [#1838] arthur.cohen
2023-04-05 14:04 ` [committed 82/88] gccrs: rename rust-hir-full-tests.cc arthur.cohen
2023-04-05 14:04 ` [committed 83/88] gccrs: add test case to show our query-type system is working arthur.cohen
2023-04-05 14:04 ` [committed 84/88] gccrs: ast: Refactor TraitItem to keep Location info arthur.cohen
2023-04-05 14:04 ` [committed 85/88] gccrs: diagnostic: Refactor Error class arthur.cohen
2023-04-05 14:04 ` [committed 86/88] gccrs: Added AST Node AST::InlineAsm arthur.cohen
2023-04-05 14:04 ` [committed 87/88] gccrs: Address unsafe with/without block handling ambiguity arthur.cohen
2023-04-05 14:04 ` [committed 88/88] gccrs: Fix issue with parsing unsafe block expression statements arthur.cohen
2023-04-06  7:59 ` Rust front-end update 2023-04-05 Thomas Schwinge
2023-04-06  9:05   ` Arthur Cohen
2023-04-11  9:09 ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230405140411.3016563-40-arthur.cohen@embecosm.com \
    --to=arthur.cohen@embecosm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc-rust@gcc.gnu.org \
    --cc=herron.philip@googlemail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).