]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_privacy/lib.rs
Rollup merge of #75485 - RalfJung:pin, r=nagisa
[rust.git] / src / librustc_privacy / lib.rs
index 3ba5acd00a09a0dd92ac5cb03d66e1150d2ae6f5..a3f2668691fd832107b443319420ed421dd4ec39 100644 (file)
@@ -226,7 +226,7 @@ fn def_id_visibility<'tcx>(
     tcx: TyCtxt<'tcx>,
     def_id: DefId,
 ) -> (ty::Visibility, Span, &'static str) {
-    match def_id.as_local().map(|def_id| tcx.hir().as_local_hir_id(def_id)) {
+    match def_id.as_local().map(|def_id| tcx.hir().local_def_id_to_hir_id(def_id)) {
         Some(hir_id) => {
             let vis = match tcx.hir().get(hir_id) {
                 Node::Item(item) => &item.vis,
@@ -431,7 +431,7 @@ impl VisibilityLike for Option<AccessLevel> {
     fn new_min(find: &FindMin<'_, '_, Self>, def_id: DefId) -> Self {
         cmp::min(
             if let Some(def_id) = def_id.as_local() {
-                let hir_id = find.tcx.hir().as_local_hir_id(def_id);
+                let hir_id = find.tcx.hir().local_def_id_to_hir_id(def_id);
                 find.access_levels.map.get(&hir_id).cloned()
             } else {
                 Self::MAX
@@ -533,7 +533,7 @@ fn update_macro_reachable_mod(&mut self, reachable_mod: hir::HirId, defining_mod
                     if let Res::Def(def_kind, def_id) = export.res {
                         let vis = def_id_visibility(self.tcx, def_id).0;
                         if let Some(def_id) = def_id.as_local() {
-                            let hir_id = self.tcx.hir().as_local_hir_id(def_id);
+                            let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
                             self.update_macro_reachable_def(hir_id, def_kind, vis, defining_mod);
                         }
                     }
@@ -650,7 +650,7 @@ fn update_visibility_of_intermediate_use_statements(
                 // there will be no corresponding item.
                 .filter(|def_id| def_id.index != CRATE_DEF_INDEX || def_id.krate != LOCAL_CRATE)
                 .and_then(|def_id| {
-                    def_id.as_local().map(|def_id| self.tcx.hir().as_local_hir_id(def_id))
+                    def_id.as_local().map(|def_id| self.tcx.hir().local_def_id_to_hir_id(def_id))
                 })
                 .map(|module_hir_id| self.tcx.hir().expect_item(module_hir_id))
             {
@@ -913,7 +913,7 @@ fn visit_mod(&mut self, m: &'tcx hir::Mod<'tcx>, _sp: Span, id: hir::HirId) {
                     if export.vis == ty::Visibility::Public {
                         if let Some(def_id) = export.res.opt_def_id() {
                             if let Some(def_id) = def_id.as_local() {
-                                let hir_id = self.tcx.hir().as_local_hir_id(def_id);
+                                let hir_id = self.tcx.hir().local_def_id_to_hir_id(def_id);
                                 self.update(hir_id, Some(AccessLevel::Exported));
                             }
                         }
@@ -1004,7 +1004,7 @@ fn tcx(&self) -> TyCtxt<'tcx> {
     }
     fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool {
         if let Some(def_id) = def_id.as_local() {
-            let hir_id = self.ev.tcx.hir().as_local_hir_id(def_id);
+            let hir_id = self.ev.tcx.hir().local_def_id_to_hir_id(def_id);
             if let ((ty::Visibility::Public, ..), _)
             | (_, Some(AccessLevel::ReachableFromImplTrait)) =
                 (def_id_visibility(self.tcx(), def_id.to_def_id()), self.access_level)
@@ -1437,7 +1437,7 @@ fn path_is_private_type(&self, path: &hir::Path<'_>) -> bool {
         if let Some(did) = did.as_local() {
             // .. and it corresponds to a private type in the AST (this returns
             // `None` for type parameters).
-            match self.tcx.hir().find(self.tcx.hir().as_local_hir_id(did)) {
+            match self.tcx.hir().find(self.tcx.hir().local_def_id_to_hir_id(did)) {
                 Some(Node::Item(ref item)) => !item.vis.node.is_pub(),
                 Some(_) | None => false,
             }
@@ -1556,7 +1556,7 @@ fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
                         let did = tr.path.res.def_id();
 
                         if let Some(did) = did.as_local() {
-                            self.trait_is_public(self.tcx.hir().as_local_hir_id(did))
+                            self.trait_is_public(self.tcx.hir().local_def_id_to_hir_id(did))
                         } else {
                             true // external traits must be public
                         }
@@ -1815,7 +1815,7 @@ fn check_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display)
         }
 
         let hir_id = match def_id.as_local() {
-            Some(def_id) => self.tcx.hir().as_local_hir_id(def_id),
+            Some(def_id) => self.tcx.hir().local_def_id_to_hir_id(def_id),
             None => return false,
         };
 
@@ -1853,7 +1853,7 @@ fn leaks_private_dep(&self, item_id: DefId) -> bool {
         let ret = self.required_visibility == ty::Visibility::Public
             && self.tcx.is_private_dep(item_id.krate);
 
-        log::debug!("leaks_private_dep(item_id={:?})={}", item_id, ret);
+        tracing::debug!("leaks_private_dep(item_id={:?})={}", item_id, ret);
         ret
     }
 }