]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: improve debug logging for unify site
authorPhilip Herron <herron.philip@googlemail.com>
Fri, 1 Aug 2025 20:48:35 +0000 (21:48 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:37:02 +0000 (16:37 +0200)
gcc/rust/ChangeLog:

* typecheck/rust-type-util.cc (unify_site_and): improve debug

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
gcc/rust/typecheck/rust-type-util.cc

index 0f14e0a60082323bdf7b86866a20cea690e73992..2d661669b3f217234331275498fe91356ddddfd2 100644 (file)
@@ -24,6 +24,7 @@
 #include "rust-hir-type-check.h"
 #include "rust-hir-type-check-type.h"
 #include "rust-casts.h"
+#include "rust-mapping-common.h"
 #include "rust-unify.h"
 #include "rust-coercion.h"
 #include "rust-hir-type-bounds.h"
@@ -186,10 +187,12 @@ unify_site_and (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
   TyTy::BaseType *expected = lhs.get_ty ();
   TyTy::BaseType *expr = rhs.get_ty ();
 
-  rust_debug (
-    "unify_site_and commit %s infer %s id={%u} expected={%s} expr={%s}",
-    commit_if_ok ? "true" : "false", implicit_infer_vars ? "true" : "false", id,
-    expected->debug_str ().c_str (), expr->debug_str ().c_str ());
+  rust_debug_loc (
+    unify_locus,
+    "begin unify_site_and commit %s infer %s id={%u} expected={%s} expr={%s}",
+    commit_if_ok ? "true" : "false", implicit_infer_vars ? "true" : "false",
+    id == UNKNOWN_HIRID ? 0 : id, expected->debug_str ().c_str (),
+    expr->debug_str ().c_str ());
 
   std::vector<UnifyRules::CommitSite> commits;
   std::vector<UnifyRules::InferenceSite> infers;
@@ -197,6 +200,15 @@ unify_site_and (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
     = UnifyRules::Resolve (lhs, rhs, unify_locus, false /*commit inline*/,
                           emit_errors, implicit_infer_vars, commits, infers);
   bool ok = result->get_kind () != TyTy::TypeKind::ERROR;
+
+  rust_debug_loc (unify_locus,
+                 "unify_site_and done ok=%s commit %s infer %s id={%u} "
+                 "expected={%s} expr={%s}",
+                 ok ? "true" : "false", commit_if_ok ? "true" : "false",
+                 implicit_infer_vars ? "true" : "false",
+                 id == UNKNOWN_HIRID ? 0 : id, expected->debug_str ().c_str (),
+                 expr->debug_str ().c_str ());
+
   if (ok && commit_if_ok)
     {
       for (auto &c : commits)