Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurikholkar committed Sep 12, 2017
1 parent ed11812 commit b2d869d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions fn.rs
@@ -0,0 +1,8 @@

fn foo(x: fn(&u8, &u8), y: Vec<&u8>, z: &u8) {
// Debruijn 1 1 1 1
// Anon-Index 0 1 0 1
// ------
// debruijn indices are shifted by 1 in here
y.push(z); // index will be zero or one
}
10 changes: 7 additions & 3 deletions src/librustc/infer/error_reporting/anon_anon_conflict.rs
Expand Up @@ -267,14 +267,17 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> {
}

hir::TyBareFn(ref fndecl) => {
fndecl.lifetimes.iter().filter_map(|lf| {
fndecl.lifetimes.iter().map(|lf| {
debug!("arg we are handling is...{:?}",arg);
match self.infcx.tcx.named_region_map.defs.get(&lf.lifetime.id) {

Some(&rl::Region::LateBoundAnon(debuijn_index, anon_index)) => {
debug!("debuijn_index.depth ={:?} self.depth = {:?} anon_index ={:?} br_index={:?}",
debuijn_index.depth, self.depth, anon_index, br_index);
if debuijn_index.depth == self.depth && anon_index == br_index {
debug!("arg is {:?}",Some(arg));
self.found_type = Some(arg);
return; // we can stop visiting now
}else{}
}
}
Some(&rl::Region::Static) |
Some(&rl::Region::EarlyBound(_, _)) |
Expand All @@ -292,6 +295,7 @@ impl<'a, 'gcx, 'tcx> Visitor<'gcx> for FindNestedTypeVisitor<'a, 'gcx, 'tcx> {
// walk the embedded contents: e.g., if we are visiting `Vec<&Foo>`,
// go on to visit `&Foo`
self.depth += 1;
debug!("depth is {:?}",self.depth);
intravisit::walk_ty(self, arg);
self.depth += 1;
}
Expand Down

0 comments on commit b2d869d

Please sign in to comment.