Skip to content

Commit b2d869d

Browse files
committed
add logs
1 parent ed11812 commit b2d869d

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

fn.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
fn foo(x: fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
3+
// Debruijn 1 1 1 1
4+
// Anon-Index 0 1 0 1
5+
// ------
6+
// debruijn indices are shifted by 1 in here
7+
y.push(z); // index will be zero or one
8+
}

src/librustc/infer/error_reporting/anon_anon_conflict.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,17 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> {
267267
}
268268

269269
hir::TyBareFn(ref fndecl) => {
270-
fndecl.lifetimes.iter().filter_map(|lf| {
270+
fndecl.lifetimes.iter().map(|lf| {
271+
debug!("arg we are handling is...{:?}",arg);
271272
match self.infcx.tcx.named_region_map.defs.get(&lf.lifetime.id) {
272-
273273
Some(&rl::Region::LateBoundAnon(debuijn_index, anon_index)) => {
274+
debug!("debuijn_index.depth ={:?} self.depth = {:?} anon_index ={:?} br_index={:?}",
275+
debuijn_index.depth, self.depth, anon_index, br_index);
274276
if debuijn_index.depth == self.depth && anon_index == br_index {
277+
debug!("arg is {:?}",Some(arg));
275278
self.found_type = Some(arg);
276279
return; // we can stop visiting now
277-
}else{}
280+
}
278281
}
279282
Some(&rl::Region::Static) |
280283
Some(&rl::Region::EarlyBound(_, _)) |
@@ -292,6 +295,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> {
292295
// walk the embedded contents: e.g., if we are visiting `Vec<&Foo>`,
293296
// go on to visit `&Foo`
294297
self.depth += 1;
298+
debug!("depth is {:?}",self.depth);
295299
intravisit::walk_ty(self, arg);
296300
self.depth += 1;
297301
}

0 commit comments

Comments
 (0)