Skip to content

Commit 2b3c86c

Browse files
committed
More and better debug messages for method typechecking
1 parent 6f441e8 commit 2b3c86c

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/rustc/middle/typeck/check/method.rs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ struct lookup {
174174
(optional_inherent_methods, subtyping_mode);
175175

176176
// if we found anything, stop before trying borrows
177-
if self.candidates.len() > 0u { break; }
177+
if self.candidates.len() > 0u {
178+
debug!{"(checking method) found at least one inherent \
179+
method; giving up looking now"};
180+
break;
181+
}
178182

179183
// Again, look for inherent and extension methods, this time using
180184
// assignability.
@@ -198,7 +202,11 @@ struct lookup {
198202
(optional_inherent_methods, mutable_reference_mode);
199203

200204
// if we found anything, stop before attempting auto-deref.
201-
if self.candidates.len() > 0u { break; }
205+
if self.candidates.len() > 0u {
206+
debug!{"(checking method) found at least one inherent \
207+
method; giving up looking now"};
208+
break;
209+
}
202210

203211
// check whether we can autoderef and if so loop around again.
204212
match ty::deref(self.tcx(), self.self_ty, false) {
@@ -210,7 +218,11 @@ struct lookup {
210218
}
211219
}
212220

213-
if self.candidates.len() == 0u { return none; }
221+
if self.candidates.len() == 0u {
222+
debug!{"(checking method) couldn't find any candidate methods; \
223+
returning none"};
224+
return none;
225+
}
214226

215227
if self.candidates.len() > 1u {
216228
self.tcx().sess.span_err(
@@ -270,7 +282,7 @@ struct lookup {
270282
}
271283

272284
fn add_candidates_from_param(n: uint, did: ast::def_id) {
273-
debug!{"candidates_from_param"};
285+
debug!{"add_candidates_from_param"};
274286

275287
let tcx = self.tcx();
276288
let mut trait_bnd_idx = 0u; // count only trait bounds
@@ -320,7 +332,7 @@ struct lookup {
320332

321333
fn add_candidates_from_trait(did: ast::def_id, trait_substs: ty::substs) {
322334

323-
debug!{"method_from_trait"};
335+
debug!{"add_candidates_from_trait"};
324336

325337
let ms = *ty::trait_methods(self.tcx(), did);
326338
for ms.eachi |i, m| {
@@ -355,7 +367,7 @@ struct lookup {
355367

356368
fn add_candidates_from_class(did: ast::def_id, class_substs: ty::substs) {
357369

358-
debug!{"method_from_class"};
370+
debug!{"add_candidates_from_class"};
359371

360372
let ms = *ty::trait_methods(self.tcx(), did);
361373

0 commit comments

Comments
 (0)