Skip to content

Commit 31909ed

Browse files
committed
gccrs: improve debug logging for unify site
gcc/rust/ChangeLog: * typecheck/rust-type-util.cc (unify_site_and): improve debug Signed-off-by: Philip Herron <[email protected]>
1 parent 41dcb21 commit 31909ed

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

gcc/rust/typecheck/rust-type-util.cc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "rust-hir-type-check.h"
2525
#include "rust-hir-type-check-type.h"
2626
#include "rust-casts.h"
27+
#include "rust-mapping-common.h"
2728
#include "rust-unify.h"
2829
#include "rust-coercion.h"
2930
#include "rust-hir-type-bounds.h"
@@ -186,17 +187,28 @@ unify_site_and (HirId id, TyTy::TyWithLocation lhs, TyTy::TyWithLocation rhs,
186187
TyTy::BaseType *expected = lhs.get_ty ();
187188
TyTy::BaseType *expr = rhs.get_ty ();
188189

189-
rust_debug (
190-
"unify_site_and commit %s infer %s id={%u} expected={%s} expr={%s}",
191-
commit_if_ok ? "true" : "false", implicit_infer_vars ? "true" : "false", id,
192-
expected->debug_str ().c_str (), expr->debug_str ().c_str ());
190+
rust_debug_loc (
191+
unify_locus,
192+
"begin unify_site_and commit %s infer %s id={%u} expected={%s} expr={%s}",
193+
commit_if_ok ? "true" : "false", implicit_infer_vars ? "true" : "false",
194+
id == UNKNOWN_HIRID ? 0 : id, expected->debug_str ().c_str (),
195+
expr->debug_str ().c_str ());
193196

194197
std::vector<UnifyRules::CommitSite> commits;
195198
std::vector<UnifyRules::InferenceSite> infers;
196199
TyTy::BaseType *result
197200
= UnifyRules::Resolve (lhs, rhs, unify_locus, false /*commit inline*/,
198201
emit_errors, implicit_infer_vars, commits, infers);
199202
bool ok = result->get_kind () != TyTy::TypeKind::ERROR;
203+
204+
rust_debug_loc (unify_locus,
205+
"unify_site_and done ok=%s commit %s infer %s id={%u} "
206+
"expected={%s} expr={%s}",
207+
ok ? "true" : "false", commit_if_ok ? "true" : "false",
208+
implicit_infer_vars ? "true" : "false",
209+
id == UNKNOWN_HIRID ? 0 : id, expected->debug_str ().c_str (),
210+
expr->debug_str ().c_str ());
211+
200212
if (ok && commit_if_ok)
201213
{
202214
for (auto &c : commits)

0 commit comments

Comments
 (0)