Skip to content

Commit 2e6fc3e

Browse files
committed
Auto merge of #52211 - bjorn3:misc_rustdoc_changes, r=QuietMisdreavus
Misc rustdoc changes
2 parents 3900bf8 + 55c11e3 commit 2e6fc3e

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

src/librustdoc/clean/mod.rs

-8
Original file line numberDiff line numberDiff line change
@@ -4435,14 +4435,6 @@ where
44354435

44364436
// Start of code copied from rust-clippy
44374437

4438-
pub fn get_trait_def_id(tcx: &TyCtxt, path: &[&str], use_local: bool) -> Option<DefId> {
4439-
if use_local {
4440-
path_to_def_local(tcx, path)
4441-
} else {
4442-
path_to_def(tcx, path)
4443-
}
4444-
}
4445-
44464438
pub fn path_to_def_local(tcx: &TyCtxt, path: &[&str]) -> Option<DefId> {
44474439
let krate = tcx.hir.krate();
44484440
let mut items = krate.module.item_ids.clone();

src/librustdoc/core.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,9 @@ pub fn run_core(search_paths: SearchPaths,
362362
};
363363

364364
let send_trait = if crate_name == Some("core".to_string()) {
365-
clean::get_trait_def_id(&tcx, &["marker", "Send"], true)
365+
clean::path_to_def_local(&tcx, &["marker", "Send"])
366366
} else {
367-
clean::get_trait_def_id(&tcx, &["core", "marker", "Send"], false)
367+
clean::path_to_def(&tcx, &["core", "marker", "Send"])
368368
};
369369

370370
let ctxt = DocContext {
@@ -390,7 +390,7 @@ pub fn run_core(search_paths: SearchPaths,
390390
debug!("crate: {:?}", tcx.hir.krate());
391391

392392
let krate = {
393-
let mut v = RustdocVisitor::new(&*cstore, &ctxt);
393+
let mut v = RustdocVisitor::new(&ctxt);
394394
v.visit(tcx.hir.krate());
395395
v.clean(&ctxt)
396396
};

src/librustdoc/visit_ast.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use syntax_pos::{self, Span};
2121
use rustc::hir::map as hir_map;
2222
use rustc::hir::def::Def;
2323
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
24-
use rustc::middle::cstore::CrateStore;
2524
use rustc::middle::privacy::AccessLevel;
2625
use rustc::util::nodemap::{FxHashSet, FxHashMap};
2726

@@ -40,7 +39,6 @@ use doctree::*;
4039
// framework from syntax?
4140

4241
pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
43-
pub cstore: &'a CrateStore,
4442
pub module: Module,
4543
pub attrs: hir::HirVec<ast::Attribute>,
4644
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
@@ -52,8 +50,7 @@ pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
5250
}
5351

5452
impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
55-
pub fn new(cstore: &'a CrateStore,
56-
cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> RustdocVisitor<'a, 'tcx, 'rcx> {
53+
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> RustdocVisitor<'a, 'tcx, 'rcx> {
5754
// If the root is re-exported, terminate all recursion.
5855
let mut stack = FxHashSet();
5956
stack.insert(ast::CRATE_NODE_ID);
@@ -65,7 +62,6 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
6562
inlining: false,
6663
inside_public_path: true,
6764
exact_paths: Some(FxHashMap()),
68-
cstore,
6965
}
7066
}
7167

0 commit comments

Comments
 (0)