public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7857] gccrs: Replace usages of Location with location_t in typechecking
@ 2024-01-16 18:04 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:9cc353d75ab97a4461c707d504e595fc3a8e2ecc

commit r14-7857-g9cc353d75ab97a4461c707d504e595fc3a8e2ecc
Author: Owen Avery <powerboat9.gamer@gmail.com>
Date:   Mon Jul 10 22:19:51 2023 -0400

    gccrs: Replace usages of Location with location_t in typechecking
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-autoderef.cc: Replace Location with location_t.
            * typecheck/rust-coercion.cc: Likewise.
            * typecheck/rust-coercion.h: Likewise.
            * typecheck/rust-hir-path-probe.h: Likewise.
            * typecheck/rust-hir-trait-reference.cc: Likewise.
            * typecheck/rust-hir-trait-resolve.cc: Likewise.
            * typecheck/rust-hir-type-check-base.cc: Likewise.
            * typecheck/rust-hir-type-check-expr.cc: Likewise.
            * typecheck/rust-hir-type-check-expr.h: Likewise.
            * typecheck/rust-hir-type-check-implitem.cc: Likewise.
            * typecheck/rust-hir-type-check-item.cc: Likewise.
            * typecheck/rust-hir-type-check-path.cc: Likewise.
            * typecheck/rust-hir-type-check-pattern.cc: Likewise.
            * typecheck/rust-hir-type-check-stmt.cc: Likewise.
            * typecheck/rust-hir-type-check-struct.cc: Likewise.
            * typecheck/rust-hir-type-check-type.cc: Likewise.
            * typecheck/rust-hir-type-check-type.h: Likewise.
            * typecheck/rust-type-util.cc: Likewise.
            * typecheck/rust-type-util.h: Likewise.
            * typecheck/rust-tyty-bounds.cc: Likewise.
            * typecheck/rust-tyty-call.cc: Likewise.
            * typecheck/rust-tyty-call.h: Likewise.
            * typecheck/rust-tyty-cmp.h: Likewise.
            * typecheck/rust-tyty-subst.cc: Likewise.
            * typecheck/rust-tyty-subst.h: Likewise.
            * typecheck/rust-tyty.cc: Likewise.

Diff:
---
 gcc/rust/typecheck/rust-autoderef.cc               |  2 +-
 gcc/rust/typecheck/rust-coercion.cc                | 28 +++----
 gcc/rust/typecheck/rust-coercion.h                 |  7 +-
 gcc/rust/typecheck/rust-hir-path-probe.h           |  3 +-
 gcc/rust/typecheck/rust-hir-trait-reference.cc     |  4 +-
 gcc/rust/typecheck/rust-hir-trait-resolve.cc       |  2 +-
 gcc/rust/typecheck/rust-hir-type-check-base.cc     |  2 +-
 gcc/rust/typecheck/rust-hir-type-check-expr.cc     | 13 +--
 gcc/rust/typecheck/rust-hir-type-check-expr.h      |  2 +-
 gcc/rust/typecheck/rust-hir-type-check-implitem.cc |  6 +-
 gcc/rust/typecheck/rust-hir-type-check-item.cc     |  6 +-
 gcc/rust/typecheck/rust-hir-type-check-path.cc     |  2 +-
 gcc/rust/typecheck/rust-hir-type-check-pattern.cc  |  2 +-
 gcc/rust/typecheck/rust-hir-type-check-stmt.cc     |  4 +-
 gcc/rust/typecheck/rust-hir-type-check-struct.cc   |  6 +-
 gcc/rust/typecheck/rust-hir-type-check-type.cc     |  2 +-
 gcc/rust/typecheck/rust-hir-type-check-type.h      |  2 +-
 gcc/rust/typecheck/rust-type-util.cc               | 10 +--
 gcc/rust/typecheck/rust-type-util.h                | 12 +--
 gcc/rust/typecheck/rust-tyty-bounds.cc             |  4 +-
 gcc/rust/typecheck/rust-tyty-call.cc               | 22 ++---
 gcc/rust/typecheck/rust-tyty-call.h                | 12 +--
 gcc/rust/typecheck/rust-tyty-cmp.h                 | 94 +++++++++++-----------
 gcc/rust/typecheck/rust-tyty-subst.cc              |  4 +-
 gcc/rust/typecheck/rust-tyty-subst.h               |  2 +-
 gcc/rust/typecheck/rust-tyty.cc                    |  4 +-
 26 files changed, 130 insertions(+), 127 deletions(-)

diff --git a/gcc/rust/typecheck/rust-autoderef.cc b/gcc/rust/typecheck/rust-autoderef.cc
index 9437f3fe0d6..9966c5469c5 100644
--- a/gcc/rust/typecheck/rust-autoderef.cc
+++ b/gcc/rust/typecheck/rust-autoderef.cc
@@ -296,7 +296,7 @@ resolve_operator_overload_fn (
 	  rust_assert (lookup->get_kind () == TyTy::TypeKind::FNDEF);
 	  fn = static_cast<TyTy::FnType *> (lookup);
 
-	  Location unify_locus = mappings->lookup_location (lhs->get_ref ());
+	  location_t unify_locus = mappings->lookup_location (lhs->get_ref ());
 	  unify_site (lhs->get_ref (),
 		      TyTy::TyWithLocation (fn->get_self_type ()),
 		      TyTy::TyWithLocation (adjusted_self), unify_locus);
diff --git a/gcc/rust/typecheck/rust-coercion.cc b/gcc/rust/typecheck/rust-coercion.cc
index cd2a6661539..97f99df9de9 100644
--- a/gcc/rust/typecheck/rust-coercion.cc
+++ b/gcc/rust/typecheck/rust-coercion.cc
@@ -116,8 +116,8 @@ TypeCoercionRules::do_coercion (TyTy::BaseType *receiver)
     }
   else if (unsafe_error)
     {
-      // Location lhs = mappings->lookup_location (receiver->get_ref ());
-      // Location rhs = mappings->lookup_location (expected->get_ref ());
+      // location_t lhs = mappings->lookup_location (receiver->get_ref ());
+      // location_t rhs = mappings->lookup_location (expected->get_ref ());
       // object_unsafe_error (locus, lhs, rhs);
       return false;
     }
@@ -215,8 +215,8 @@ TypeCoercionRules::coerce_unsafe_ptr (TyTy::BaseType *receiver,
 
   if (!coerceable_mutability (from_mutbl, to_mutbl))
     {
-      Location lhs = mappings->lookup_location (receiver->get_ref ());
-      Location rhs = mappings->lookup_location (expected->get_ref ());
+      location_t lhs = mappings->lookup_location (receiver->get_ref ());
+      location_t rhs = mappings->lookup_location (expected->get_ref ());
       mismatched_mutability_error (locus, lhs, rhs);
       return TypeCoercionRules::CoercionResult::get_error ();
     }
@@ -294,8 +294,8 @@ TypeCoercionRules::coerce_borrowed_pointer (TyTy::BaseType *receiver,
 
   if (!coerceable_mutability (from_mutbl, to_mutbl))
     {
-      Location lhs = mappings->lookup_location (receiver->get_ref ());
-      Location rhs = mappings->lookup_location (expected->get_ref ());
+      location_t lhs = mappings->lookup_location (receiver->get_ref ());
+      location_t rhs = mappings->lookup_location (expected->get_ref ());
       mismatched_mutability_error (locus, lhs, rhs);
       return TypeCoercionRules::CoercionResult::get_error ();
     }
@@ -339,8 +339,8 @@ TypeCoercionRules::coerce_unsized (TyTy::BaseType *source,
       if (!coerceable_mutability (from_mutbl, to_mutbl))
 	{
 	  unsafe_error = true;
-	  Location lhs = mappings->lookup_location (source->get_ref ());
-	  Location rhs = mappings->lookup_location (target->get_ref ());
+	  location_t lhs = mappings->lookup_location (source->get_ref ());
+	  location_t rhs = mappings->lookup_location (target->get_ref ());
 	  mismatched_mutability_error (locus, lhs, rhs);
 	  return TypeCoercionRules::CoercionResult::get_error ();
 	}
@@ -364,8 +364,8 @@ TypeCoercionRules::coerce_unsized (TyTy::BaseType *source,
       if (!coerceable_mutability (from_mutbl, to_mutbl))
 	{
 	  unsafe_error = true;
-	  Location lhs = mappings->lookup_location (source->get_ref ());
-	  Location rhs = mappings->lookup_location (target->get_ref ());
+	  location_t lhs = mappings->lookup_location (source->get_ref ());
+	  location_t rhs = mappings->lookup_location (target->get_ref ());
 	  mismatched_mutability_error (locus, lhs, rhs);
 	  return TypeCoercionRules::CoercionResult::get_error ();
 	}
@@ -459,8 +459,8 @@ TypeCoercionRules::coerceable_mutability (Mutability from_mutbl,
 }
 
 void
-TypeCoercionRules::mismatched_mutability_error (Location expr_locus,
-						Location lhs, Location rhs)
+TypeCoercionRules::mismatched_mutability_error (location_t expr_locus,
+						location_t lhs, location_t rhs)
 {
   if (!emit_errors)
     return;
@@ -472,8 +472,8 @@ TypeCoercionRules::mismatched_mutability_error (Location expr_locus,
 }
 
 void
-TypeCoercionRules::object_unsafe_error (Location expr_locus, Location lhs,
-					Location rhs)
+TypeCoercionRules::object_unsafe_error (location_t expr_locus, location_t lhs,
+					location_t rhs)
 {
   if (!emit_errors)
     return;
diff --git a/gcc/rust/typecheck/rust-coercion.h b/gcc/rust/typecheck/rust-coercion.h
index b8e557351bc..069927beaac 100644
--- a/gcc/rust/typecheck/rust-coercion.h
+++ b/gcc/rust/typecheck/rust-coercion.h
@@ -65,9 +65,10 @@ public:
   static bool coerceable_mutability (Mutability from_mutbl,
 				     Mutability to_mutbl);
 
-  void mismatched_mutability_error (Location expr_locus, Location lhs,
-				    Location rhs);
-  void object_unsafe_error (Location expr_locus, Location lhs, Location rhs);
+  void mismatched_mutability_error (location_t expr_locus, location_t lhs,
+				    location_t rhs);
+  void object_unsafe_error (location_t expr_locus, location_t lhs,
+			    location_t rhs);
 
 protected:
   TypeCoercionRules (TyTy::BaseType *expected, location_t locus,
diff --git a/gcc/rust/typecheck/rust-hir-path-probe.h b/gcc/rust/typecheck/rust-hir-path-probe.h
index e70372bf101..3fd96e63105 100644
--- a/gcc/rust/typecheck/rust-hir-path-probe.h
+++ b/gcc/rust/typecheck/rust-hir-path-probe.h
@@ -158,7 +158,8 @@ class ReportMultipleCandidateError : private TypeCheckBase
 {
 public:
   static void Report (std::set<PathProbeCandidate> &candidates,
-		      const HIR::PathIdentSegment &query, Location query_locus)
+		      const HIR::PathIdentSegment &query,
+		      location_t query_locus)
   {
     rich_location r (line_table, query_locus);
     for (auto &c : candidates)
diff --git a/gcc/rust/typecheck/rust-hir-trait-reference.cc b/gcc/rust/typecheck/rust-hir-trait-reference.cc
index d089e23b058..e32ab533592 100644
--- a/gcc/rust/typecheck/rust-hir-trait-reference.cc
+++ b/gcc/rust/typecheck/rust-hir-trait-reference.cc
@@ -57,7 +57,7 @@ TraitItemReference::get_hir_trait_item () const
   return hir_trait_item;
 }
 
-Location
+location_t
 TraitItemReference::get_locus () const
 {
   return locus;
@@ -148,7 +148,7 @@ TraitReference::is_error () const
   return hir_trait_ref == nullptr;
 }
 
-Location
+location_t
 TraitReference::get_locus () const
 {
   return hir_trait_ref->get_locus ();
diff --git a/gcc/rust/typecheck/rust-hir-trait-resolve.cc b/gcc/rust/typecheck/rust-hir-trait-resolve.cc
index 37132a73131..97fec48909a 100644
--- a/gcc/rust/typecheck/rust-hir-trait-resolve.cc
+++ b/gcc/rust/typecheck/rust-hir-trait-resolve.cc
@@ -349,7 +349,7 @@ TraitItemReference::resolve_item (HIR::TraitItemFunc &func)
 
   auto block_expr_ty = TypeCheckExpr::Resolve (func.get_block_expr ().get ());
 
-  Location fn_return_locus
+  location_t fn_return_locus
     = func.get_decl ().has_return_type ()
 	? func.get_decl ().get_return_type ()->get_locus ()
 	: func.get_locus ();
diff --git a/gcc/rust/typecheck/rust-hir-type-check-base.cc b/gcc/rust/typecheck/rust-hir-type-check-base.cc
index f0f820c2c1b..ae433e859ac 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-base.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-base.cc
@@ -44,7 +44,7 @@ TypeCheckBase::check_for_unconstrained (
     return check_result;
 
   std::set<HirId> symbols_to_constrain;
-  std::map<HirId, Location> symbol_to_location;
+  std::map<HirId, location_t> symbol_to_location;
   for (const auto &p : params_to_constrain)
     {
       HirId ref = p.get_param_ty ()->get_ref ();
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index 0b72fb617a5..7a7b3ac7314 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -151,8 +151,9 @@ void
 TypeCheckExpr::visit (HIR::ReturnExpr &expr)
 {
   auto fn_return_tyty = context->peek_return_type ();
-  Location expr_locus = expr.has_return_expr () ? expr.get_expr ()->get_locus ()
-						: expr.get_locus ();
+  location_t expr_locus = expr.has_return_expr ()
+			    ? expr.get_expr ()->get_locus ()
+			    : expr.get_locus ();
   TyTy::BaseType *expr_ty
     = expr.has_return_expr ()
 	? TypeCheckExpr::Resolve (expr.get_expr ().get ())
@@ -1503,9 +1504,9 @@ TypeCheckExpr::visit (HIR::ClosureExpr &expr)
 			   parameter_types);
   context->insert_implicit_type (closure_args);
 
-  Location result_type_locus = expr.has_return_type ()
-				 ? expr.get_return_type ()->get_locus ()
-				 : expr.get_locus ();
+  location_t result_type_locus = expr.has_return_type ()
+				   ? expr.get_return_type ()->get_locus ()
+				   : expr.get_locus ();
   TyTy::TyVar result_type
     = expr.has_return_type ()
 	? TyTy::TyVar (
@@ -1513,7 +1514,7 @@ TypeCheckExpr::visit (HIR::ClosureExpr &expr)
 	: TyTy::TyVar::get_implicit_infer_var (expr.get_locus ());
 
   // resolve the block
-  Location closure_expr_locus = expr.get_expr ()->get_locus ();
+  location_t closure_expr_locus = expr.get_expr ()->get_locus ();
   TyTy::BaseType *closure_expr_ty
     = TypeCheckExpr::Resolve (expr.get_expr ().get ());
   coercion_site (expr.get_mappings ().get_hirid (),
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.h b/gcc/rust/typecheck/rust-hir-type-check-expr.h
index 724eee8d9b5..e9890da60c5 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.h
@@ -118,7 +118,7 @@ private:
 			 std::vector<HIR::PathExprSegment> &segments,
 			 size_t offset, TyTy::BaseType *tyseg,
 			 const Analysis::NodeMapping &expr_mappings,
-			 Location expr_locus);
+			 location_t expr_locus);
 
   bool
   validate_arithmetic_type (const TyTy::BaseType *tyty,
diff --git a/gcc/rust/typecheck/rust-hir-type-check-implitem.cc b/gcc/rust/typecheck/rust-hir-type-check-implitem.cc
index f63f2d15420..5fb6fa3190e 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-implitem.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-implitem.cc
@@ -317,9 +317,9 @@ TypeCheckImplItem::visit (HIR::Function &function)
   auto block_expr_ty
     = TypeCheckExpr::Resolve (function.get_definition ().get ());
 
-  Location fn_return_locus = function.has_function_return_type ()
-			       ? function.get_return_type ()->get_locus ()
-			       : function.get_locus ();
+  location_t fn_return_locus = function.has_function_return_type ()
+				 ? function.get_return_type ()->get_locus ()
+				 : function.get_locus ();
 
   coercion_site (function.get_definition ()->get_mappings ().get_hirid (),
 		 TyTy::TyWithLocation (expected_ret_tyty, fn_return_locus),
diff --git a/gcc/rust/typecheck/rust-hir-type-check-item.cc b/gcc/rust/typecheck/rust-hir-type-check-item.cc
index e8a4f97ed25..98c5c1a4fec 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-item.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-item.cc
@@ -495,9 +495,9 @@ TypeCheckItem::visit (HIR::Function &function)
   auto block_expr_ty
     = TypeCheckExpr::Resolve (function.get_definition ().get ());
 
-  Location fn_return_locus = function.has_function_return_type ()
-			       ? function.get_return_type ()->get_locus ()
-			       : function.get_locus ();
+  location_t fn_return_locus = function.has_function_return_type ()
+				 ? function.get_return_type ()->get_locus ()
+				 : function.get_locus ();
   coercion_site (function.get_definition ()->get_mappings ().get_hirid (),
 		 TyTy::TyWithLocation (expected_ret_tyty, fn_return_locus),
 		 TyTy::TyWithLocation (block_expr_ty),
diff --git a/gcc/rust/typecheck/rust-hir-type-check-path.cc b/gcc/rust/typecheck/rust-hir-type-check-path.cc
index daa5ac78878..43a779dc1e8 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-path.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-path.cc
@@ -320,7 +320,7 @@ TypeCheckExpr::resolve_segments (NodeId root_resolved_node_id,
 				 std::vector<HIR::PathExprSegment> &segments,
 				 size_t offset, TyTy::BaseType *tyseg,
 				 const Analysis::NodeMapping &expr_mappings,
-				 Location expr_locus)
+				 location_t expr_locus)
 {
   NodeId resolved_node_id = root_resolved_node_id;
   TyTy::BaseType *prev_segment = tyseg;
diff --git a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
index 67af3c63647..97370454bbd 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-pattern.cc
@@ -140,7 +140,7 @@ TypeCheckPattern::visit (HIR::TupleStructPattern &pattern)
 }
 
 void
-emit_invalid_field_error (Location loc, Rust::TyTy::VariantDef *variant,
+emit_invalid_field_error (location_t loc, Rust::TyTy::VariantDef *variant,
 			  const std::string &name)
 {
   rust_error_at (loc, ErrorCode::E0026,
diff --git a/gcc/rust/typecheck/rust-hir-type-check-stmt.cc b/gcc/rust/typecheck/rust-hir-type-check-stmt.cc
index 4efbd40e1a4..99eb41d6e0c 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-stmt.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-stmt.cc
@@ -78,7 +78,7 @@ TypeCheckStmt::visit (HIR::LetStmt &stmt)
 
   HIR::Pattern &stmt_pattern = *stmt.get_pattern ();
   TyTy::BaseType *init_expr_ty = nullptr;
-  Location init_expr_locus = UNKNOWN_LOCATION;
+  location_t init_expr_locus = UNKNOWN_LOCATION;
   if (stmt.has_init_expr ())
     {
       init_expr_locus = stmt.get_init_expr ()->get_locus ();
@@ -91,7 +91,7 @@ TypeCheckStmt::visit (HIR::LetStmt &stmt)
     }
 
   TyTy::BaseType *specified_ty = nullptr;
-  Location specified_ty_locus;
+  location_t specified_ty_locus;
   if (stmt.has_type ())
     {
       specified_ty = TypeCheckType::Resolve (stmt.get_type ().get ());
diff --git a/gcc/rust/typecheck/rust-hir-type-check-struct.cc b/gcc/rust/typecheck/rust-hir-type-check-struct.cc
index 5688aafe7b4..f2dd8b6aa6e 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-struct.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-struct.cc
@@ -259,7 +259,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIdentifierValue &field)
     }
 
   TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value ().get ());
-  Location value_locus = field.get_value ()->get_locus ();
+  location_t value_locus = field.get_value ()->get_locus ();
 
   HirId coercion_site_id = field.get_mappings ().get_hirid ();
   resolved_field_value_expr
@@ -296,7 +296,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIndexValue &field)
     }
 
   TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value ().get ());
-  Location value_locus = field.get_value ()->get_locus ();
+  location_t value_locus = field.get_value ()->get_locus ();
 
   HirId coercion_site_id = field.get_mappings ().get_hirid ();
   resolved_field_value_expr
@@ -343,7 +343,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIdentifier &field)
   HIR::PathInExpression expr (mappings_copy2, {seg}, field.get_locus (), false,
 			      {});
   TyTy::BaseType *value = TypeCheckExpr::Resolve (&expr);
-  Location value_locus = expr.get_locus ();
+  location_t value_locus = expr.get_locus ();
 
   HirId coercion_site_id = field.get_mappings ().get_hirid ();
   resolved_field_value_expr
diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.cc b/gcc/rust/typecheck/rust-hir-type-check-type.cc
index 779e7fd50de..c3bc14b0989 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.cc
@@ -450,7 +450,7 @@ TypeCheckType::resolve_segments (
   NodeId root_resolved_node_id, HirId expr_id,
   std::vector<std::unique_ptr<HIR::TypePathSegment>> &segments, size_t offset,
   TyTy::BaseType *tyseg, const Analysis::NodeMapping &expr_mappings,
-  Location expr_locus)
+  location_t expr_locus)
 {
   NodeId resolved_node_id = root_resolved_node_id;
   TyTy::BaseType *prev_segment = tyseg;
diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.h b/gcc/rust/typecheck/rust-hir-type-check-type.h
index 05b41abaec3..b9b129b0667 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.h
@@ -88,7 +88,7 @@ private:
     NodeId root_resolved_node_id, HirId expr_id,
     std::vector<std::unique_ptr<HIR::TypePathSegment>> &segments, size_t offset,
     TyTy::BaseType *tyseg, const Analysis::NodeMapping &expr_mappings,
-    Location expr_locus);
+    location_t expr_locus);
 
   TyTy::BaseType *translated;
 };
diff --git a/gcc/rust/typecheck/rust-type-util.cc b/gcc/rust/typecheck/rust-type-util.cc
index e5b42df9cc5..eed3ff417c8 100644
--- a/gcc/rust/typecheck/rust-type-util.cc
+++ b/gcc/rust/typecheck/rust-type-util.cc
@@ -115,7 +115,7 @@ query_type (HirId reference, TyTy::BaseType **result)
     }
 
   // more?
-  Location possible_locus = mappings->lookup_location (reference);
+  location_t possible_locus = mappings->lookup_location (reference);
   rust_debug_loc (possible_locus, "query system failed to resolve: [%u]",
 		  reference);
   context->query_completed (reference);
@@ -125,7 +125,7 @@ query_type (HirId reference, TyTy::BaseType **result)
 
 bool
 types_compatable (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-		  Location unify_locus, bool emit_errors)
+		  location_t unify_locus, bool emit_errors)
 {
   TyTy::BaseType *result
     = unify_site_and (UNKNOWN_HIRID, lhs, rhs, unify_locus, emit_errors,
@@ -135,7 +135,7 @@ types_compatable (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
 
 TyTy::BaseType *
 unify_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-	    Location unify_locus)
+	    location_t unify_locus)
 {
   TyTy::BaseType *expected = lhs.get_ty ();
   TyTy::BaseType *expr = rhs.get_ty ();
@@ -152,7 +152,7 @@ unify_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
 
 TyTy::BaseType *
 unify_site_and (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-		Location unify_locus, bool emit_errors, bool commit_if_ok,
+		location_t unify_locus, bool emit_errors, bool commit_if_ok,
 		bool implicit_infer_vars, bool cleanup)
 {
   TypeCheckContext &context = *TypeCheckContext::get ();
@@ -251,7 +251,7 @@ try_coercion (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
 
 TyTy::BaseType *
 cast_site (HirId id, TyTy::TyWithLocation from, TyTy::TyWithLocation to,
-	   Location cast_locus)
+	   location_t cast_locus)
 {
   rust_debug ("cast_site id={%u} from={%s} to={%s}", id,
 	      from.get_ty ()->debug_str ().c_str (),
diff --git a/gcc/rust/typecheck/rust-type-util.h b/gcc/rust/typecheck/rust-type-util.h
index 595388ef34f..d7b00ed6d95 100644
--- a/gcc/rust/typecheck/rust-type-util.h
+++ b/gcc/rust/typecheck/rust-type-util.h
@@ -30,28 +30,28 @@ query_type (HirId reference, TyTy::BaseType **result);
 
 bool
 types_compatable (TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-		  Location unify_locus, bool emit_errors);
+		  location_t unify_locus, bool emit_errors);
 
 TyTy::BaseType *
 unify_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-	    Location unify_locus);
+	    location_t unify_locus);
 
 TyTy::BaseType *
 unify_site_and (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-		Location unify_locus, bool emit_errors, bool commit_if_ok,
+		location_t unify_locus, bool emit_errors, bool commit_if_ok,
 		bool implicit_infer_vars, bool cleanup);
 
 TyTy::BaseType *
 coercion_site (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-	       Location coercion_locus);
+	       location_t coercion_locus);
 
 TyTy::BaseType *
 try_coercion (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
-	      Location coercion_locus);
+	      location_t coercion_locus);
 
 TyTy::BaseType *
 cast_site (HirId id, TyTy::TyWithLocation from, TyTy::TyWithLocation to,
-	   Location cast_locus);
+	   location_t cast_locus);
 
 AssociatedImplTrait *
 lookup_associated_impl_block (const TyTy::TypeBoundPredicate &bound,
diff --git a/gcc/rust/typecheck/rust-tyty-bounds.cc b/gcc/rust/typecheck/rust-tyty-bounds.cc
index c17f27b9e13..805028f147a 100644
--- a/gcc/rust/typecheck/rust-tyty-bounds.cc
+++ b/gcc/rust/typecheck/rust-tyty-bounds.cc
@@ -236,7 +236,7 @@ TypeCheckBase::get_predicate_from_bound (HIR::TypePath &type_path,
 	  Analysis::RustLangItem::ItemType::FN_ONCE_OUTPUT);
 
 	std::vector<HIR::GenericArgsBinding> bindings;
-	Location output_locus = fn.get_return_type ()->get_locus ();
+	location_t output_locus = fn.get_return_type ()->get_locus ();
 	HIR::GenericArgsBinding binding (Identifier (
 					   trait_item->trait_identifier ()),
 					 fn.get_return_type ()->clone_type (),
@@ -732,7 +732,7 @@ TypeBoundPredicateItem::needs_implementation () const
   return !get_raw_item ()->is_optional ();
 }
 
-Location
+location_t
 TypeBoundPredicateItem::get_locus () const
 {
   return get_raw_item ()->get_locus ();
diff --git a/gcc/rust/typecheck/rust-tyty-call.cc b/gcc/rust/typecheck/rust-tyty-call.cc
index f2e5e85e484..9ba3fd83f0e 100644
--- a/gcc/rust/typecheck/rust-tyty-call.cc
+++ b/gcc/rust/typecheck/rust-tyty-call.cc
@@ -24,7 +24,7 @@ namespace Rust {
 namespace TyTy {
 
 void
-emit_unexpected_argument_error (Location loc,
+emit_unexpected_argument_error (location_t loc,
 				unsigned long unexpected_arg_count,
 				unsigned long expected_arg_count)
 {
@@ -78,7 +78,7 @@ TypeCheckCallExpr::visit (ADTType &type)
     {
       StructFieldType *field = variant.get_field_at_index (i);
       BaseType *field_tyty = field->get_field_type ();
-      Location arg_locus = argument->get_locus ();
+      location_t arg_locus = argument->get_locus ();
 
       BaseType *arg = Resolver::TypeCheckExpr::Resolve (argument.get ());
       if (arg->get_kind () == TyTy::TypeKind::ERROR)
@@ -138,7 +138,7 @@ TypeCheckCallExpr::visit (FnType &type)
   size_t i = 0;
   for (auto &argument : call.get_arguments ())
     {
-      Location arg_locus = argument->get_locus ();
+      location_t arg_locus = argument->get_locus ();
       auto argument_expr_tyty
 	= Resolver::TypeCheckExpr::Resolve (argument.get ());
       if (argument_expr_tyty->get_kind () == TyTy::TypeKind::ERROR)
@@ -155,7 +155,7 @@ TypeCheckCallExpr::visit (FnType &type)
 	  auto fnparam = type.param_at (i);
 	  HIR::Pattern *fn_param_pattern = fnparam.first;
 	  BaseType *param_ty = fnparam.second;
-	  Location param_locus
+	  location_t param_locus
 	    = fn_param_pattern == nullptr
 		? mappings->lookup_location (param_ty->get_ref ())
 		: fn_param_pattern->get_locus ();
@@ -255,7 +255,7 @@ TypeCheckCallExpr::visit (FnPtr &type)
   size_t i = 0;
   for (auto &argument : call.get_arguments ())
     {
-      Location arg_locus = argument->get_locus ();
+      location_t arg_locus = argument->get_locus ();
       BaseType *fnparam = type.param_at (i);
       auto argument_expr_tyty
 	= Resolver::TypeCheckExpr::Resolve (argument.get ());
@@ -292,8 +292,8 @@ TypeCheckCallExpr::visit (FnPtr &type)
 
 TypeCheckMethodCallExpr::TypeCheckMethodCallExpr (
   Analysis::NodeMapping call_mappings, std::vector<Argument> &args,
-  Location call_locus, Location receiver_locus, TyTy::BaseType *adjusted_self,
-  Resolver::TypeCheckContext *context)
+  location_t call_locus, location_t receiver_locus,
+  TyTy::BaseType *adjusted_self, Resolver::TypeCheckContext *context)
   : call_mappings (call_mappings), arguments (args), call_locus (call_locus),
     receiver_locus (receiver_locus), adjusted_self (adjusted_self),
     context (context), mappings (Analysis::Mappings::get ())
@@ -329,8 +329,8 @@ TypeCheckMethodCallExpr::go (FnType *ref, HIR::MethodCallExpr &call,
 
 BaseType *
 TypeCheckMethodCallExpr::go (FnType *ref, Analysis::NodeMapping call_mappings,
-			     std::vector<Argument> &args, Location call_locus,
-			     Location receiver_locus,
+			     std::vector<Argument> &args, location_t call_locus,
+			     location_t receiver_locus,
 			     TyTy::BaseType *adjusted_self,
 			     Resolver::TypeCheckContext *context)
 {
@@ -360,12 +360,12 @@ TypeCheckMethodCallExpr::check (FnType &type)
   size_t i = 1;
   for (auto &argument : arguments)
     {
-      Location arg_locus = argument.get_locus ();
+      location_t arg_locus = argument.get_locus ();
 
       auto fnparam = type.param_at (i);
       HIR::Pattern *fn_param_pattern = fnparam.first;
       BaseType *param_ty = fnparam.second;
-      Location param_locus
+      location_t param_locus
 	= fn_param_pattern == nullptr
 	    ? mappings->lookup_location (param_ty->get_ref ())
 	    : fn_param_pattern->get_locus ();
diff --git a/gcc/rust/typecheck/rust-tyty-call.h b/gcc/rust/typecheck/rust-tyty-call.h
index 895e58225d0..0d3c0c64d18 100644
--- a/gcc/rust/typecheck/rust-tyty-call.h
+++ b/gcc/rust/typecheck/rust-tyty-call.h
@@ -112,23 +112,23 @@ public:
 		       Resolver::TypeCheckContext *context);
 
   static BaseType *go (FnType *ref, Analysis::NodeMapping call_mappings,
-		       std::vector<Argument> &args, Location call_locus,
-		       Location receiver_locus, TyTy::BaseType *adjusted_self,
+		       std::vector<Argument> &args, location_t call_locus,
+		       location_t receiver_locus, TyTy::BaseType *adjusted_self,
 		       Resolver::TypeCheckContext *context);
 
 protected:
   BaseType *check (FnType &type);
 
   TypeCheckMethodCallExpr (Analysis::NodeMapping call_mappings,
-			   std::vector<Argument> &args, Location call_locus,
-			   Location receiver_locus,
+			   std::vector<Argument> &args, location_t call_locus,
+			   location_t receiver_locus,
 			   TyTy::BaseType *adjusted_self,
 			   Resolver::TypeCheckContext *context);
 
   Analysis::NodeMapping call_mappings;
   std::vector<Argument> &arguments;
-  Location call_locus;
-  Location receiver_locus;
+  location_t call_locus;
+  location_t receiver_locus;
   TyTy::BaseType *adjusted_self;
   Resolver::TypeCheckContext *context;
   Analysis::Mappings *mappings;
diff --git a/gcc/rust/typecheck/rust-tyty-cmp.h b/gcc/rust/typecheck/rust-tyty-cmp.h
index 3c2ae578e79..6d4bc16bf6e 100644
--- a/gcc/rust/typecheck/rust-tyty-cmp.h
+++ b/gcc/rust/typecheck/rust-tyty-cmp.h
@@ -62,8 +62,8 @@ public:
 
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -78,8 +78,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -94,8 +94,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -110,8 +110,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -126,8 +126,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -142,8 +142,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -158,8 +158,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -174,8 +174,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -190,8 +190,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -206,8 +206,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -222,8 +222,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -238,8 +238,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -254,8 +254,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -270,8 +270,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -286,8 +286,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -302,8 +302,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -318,8 +318,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -334,8 +334,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -350,8 +350,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -366,8 +366,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -388,8 +388,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -404,8 +404,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -420,8 +420,8 @@ public:
     ok = false;
     if (emit_error_flag)
       {
-	Location ref_locus = mappings->lookup_location (type.get_ref ());
-	Location base_locus
+	location_t ref_locus = mappings->lookup_location (type.get_ref ());
+	location_t base_locus
 	  = mappings->lookup_location (get_base ()->get_ref ());
 	rich_location r (line_table, ref_locus);
 	r.add_range (base_locus);
@@ -1561,7 +1561,7 @@ public:
 	return;
       }
 
-    Location ref_locus = mappings->lookup_location (type.get_ref ());
+    location_t ref_locus = mappings->lookup_location (type.get_ref ());
     ok = base->bounds_compatible (type, ref_locus, false);
   }
 
diff --git a/gcc/rust/typecheck/rust-tyty-subst.cc b/gcc/rust/typecheck/rust-tyty-subst.cc
index ba23eafee6f..64ae256f856 100644
--- a/gcc/rust/typecheck/rust-tyty-subst.cc
+++ b/gcc/rust/typecheck/rust-tyty-subst.cc
@@ -76,7 +76,7 @@ SubstitutionParamMapping::needs_substitution () const
   return !(get_param_ty ()->is_concrete ());
 }
 
-Location
+location_t
 SubstitutionParamMapping::get_param_locus () const
 {
   return generic.get_locus ();
@@ -333,7 +333,7 @@ SubstitutionArgumentMappings::is_concrete () const
   return true;
 }
 
-Location
+location_t
 SubstitutionArgumentMappings::get_locus () const
 {
   return locus;
diff --git a/gcc/rust/typecheck/rust-tyty-subst.h b/gcc/rust/typecheck/rust-tyty-subst.h
index 9ccbafa8727..d9d179d426f 100644
--- a/gcc/rust/typecheck/rust-tyty-subst.h
+++ b/gcc/rust/typecheck/rust-tyty-subst.h
@@ -56,7 +56,7 @@ public:
 
   bool needs_substitution () const;
 
-  Location get_param_locus () const;
+  location_t get_param_locus () const;
 
   bool param_has_default_ty () const;
 
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index a4cb8f2da94..d5c1a4aca57 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -265,7 +265,7 @@ BaseType::get_ident () const
   return ident;
 }
 
-Location
+location_t
 BaseType::get_locus () const
 {
   return ident.locus;
@@ -1349,7 +1349,7 @@ StructFieldType::debug () const
   rust_debug ("%s", as_string ().c_str ());
 }
 
-Location
+location_t
 StructFieldType::get_locus () const
 {
   return locus;

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

only message in thread, other threads:[~2024-01-16 18:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:04 [gcc r14-7857] gccrs: Replace usages of Location with location_t in typechecking Arthur Cohen

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).