From b2d869dc8075a78d5f2f163f6691bad14b16e4b0 Mon Sep 17 00:00:00 2001 From: gaurikholkar Date: Tue, 15 Aug 2017 22:16:29 +0530 Subject: [PATCH] add logs --- fn.rs | 8 ++++++++ .../infer/error_reporting/anon_anon_conflict.rs | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 fn.rs diff --git a/fn.rs b/fn.rs new file mode 100644 index 0000000000000..186eda95fecbd --- /dev/null +++ b/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 +} diff --git a/src/librustc/infer/error_reporting/anon_anon_conflict.rs b/src/librustc/infer/error_reporting/anon_anon_conflict.rs index bb4782d2c8f5c..634f578866071 100644 --- a/src/librustc/infer/error_reporting/anon_anon_conflict.rs +++ b/src/librustc/infer/error_reporting/anon_anon_conflict.rs @@ -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(_, _)) | @@ -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; }