about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-06-02 20:23:37 +0000
committerbors <bors@rust-lang.org>2021-06-02 20:23:37 +0000
commitdbe459dedd33470f2cb28101157de316caaffa66 (patch)
tree633532415b22f80b45f6da0853d47451175f5b46 /src
parent2f601ef527a37de9fb181c5fb1a6c06d06218ed3 (diff)
parent0e71283495c88c01c6a3b8f650d88baf612aab0e (diff)
downloadrust-dbe459dedd33470f2cb28101157de316caaffa66.tar.gz
rust-dbe459dedd33470f2cb28101157de316caaffa66.zip
Auto merge of #85904 - cjgillot:one-name, r=petrochenkov
Restrict access to crate_name.

Also remove original_crate_name, which had the exact same implementation.

Part of #85153
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/clean/inline.rs2
-rw-r--r--src/librustdoc/visit_ast.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index a14eefaf571..111827aacdf 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -527,7 +527,7 @@ fn build_static(cx: &mut DocContext<'_>, did: DefId, mutable: bool) -> clean::St
 }
 
 fn build_macro(cx: &mut DocContext<'_>, did: DefId, name: Symbol) -> clean::ItemKind {
-    let imported_from = cx.tcx.original_crate_name(did.krate);
+    let imported_from = cx.tcx.crate_name(did.krate);
     match cx.enter_resolver(|r| r.cstore().load_macro_untracked(did, cx.sess())) {
         LoadedMacro::MacroDef(def, _) => {
             let matchers: Vec<Span> = if let ast::ItemKind::MacroDef(ref def) = def.kind {
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index 191d8d5a2ea..b563c4f4799 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -9,6 +9,7 @@ use rustc_hir::Node;
 use rustc_middle::middle::privacy::AccessLevel;
 use rustc_middle::ty::TyCtxt;
 use rustc_span;
+use rustc_span::def_id::LOCAL_CRATE;
 use rustc_span::source_map::Spanned;
 use rustc_span::symbol::{kw, sym, Symbol};
 
@@ -76,7 +77,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
             &Spanned { span, node: hir::VisibilityKind::Public },
             hir::CRATE_HIR_ID,
             &krate.item,
-            self.cx.tcx.crate_name,
+            self.cx.tcx.crate_name(LOCAL_CRATE),
         );
         // Attach the crate's exported macros to the top-level module.
         // In the case of macros 2.0 (`pub macro`), and for built-in `derive`s or attributes as