]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/infer/error_reporting/anon_anon_conflict.rs
rustc: Hide the `named_region_map` behind queries
[rust.git] / src / librustc / infer / error_reporting / anon_anon_conflict.rs
index c80ce3c96f1a98a3d44870719fd5edffcd028f4e..d3fff4c66af07850ccd08623776ad07d4c7ccfbb 100644 (file)
@@ -209,18 +209,19 @@ fn visit_ty(&mut self, arg: &'gcx hir::Ty) {
 
         match arg.node {
             hir::TyRptr(ref lifetime, _) => {
-                match self.infcx.tcx.named_region_map.defs.get(&lifetime.id) {
+                let hir_id = self.infcx.tcx.hir.node_to_hir_id(lifetime.id);
+                match self.infcx.tcx.named_region(hir_id) {
                     // the lifetime of the TyRptr
-                    Some(&rl::Region::LateBoundAnon(debruijn_index, anon_index)) => {
+                    Some(rl::Region::LateBoundAnon(debruijn_index, anon_index)) => {
                         if debruijn_index.depth == 1 && anon_index == br_index {
                             self.found_type = Some(arg);
                             return; // we can stop visiting now
                         }
                     }
-                    Some(&rl::Region::Static) |
-                    Some(&rl::Region::EarlyBound(_, _)) |
-                    Some(&rl::Region::LateBound(_, _)) |
-                    Some(&rl::Region::Free(_, _)) |
+                    Some(rl::Region::Static) |
+                    Some(rl::Region::EarlyBound(_, _)) |
+                    Some(rl::Region::LateBound(_, _)) |
+                    Some(rl::Region::Free(_, _)) |
                     None => {
                         debug!("no arg found");
                     }
@@ -272,17 +273,18 @@ fn visit_lifetime(&mut self, lifetime: &hir::Lifetime) {
             _ => return,
         };
 
-        match self.infcx.tcx.named_region_map.defs.get(&lifetime.id) {
+        let hir_id = self.infcx.tcx.hir.node_to_hir_id(lifetime.id);
+        match self.infcx.tcx.named_region(hir_id) {
             // the lifetime of the TyPath!
-            Some(&rl::Region::LateBoundAnon(debruijn_index, anon_index)) => {
+            Some(rl::Region::LateBoundAnon(debruijn_index, anon_index)) => {
                 if debruijn_index.depth == 1 && anon_index == br_index {
                     self.found_it = true;
                 }
             }
-            Some(&rl::Region::Static) |
-            Some(&rl::Region::EarlyBound(_, _)) |
-            Some(&rl::Region::LateBound(_, _)) |
-            Some(&rl::Region::Free(_, _)) |
+            Some(rl::Region::Static) |
+            Some(rl::Region::EarlyBound(_, _)) |
+            Some(rl::Region::LateBound(_, _)) |
+            Some(rl::Region::Free(_, _)) |
             None => {
                 debug!("no arg found");
             }