Auto merge of #52211 - bjorn3:misc_rustdoc_changes, r=QuietMisdreavus
Misc rustdoc changes
This commit is contained in:
commit
2e6fc3e2c0
|
@ -4435,14 +4435,6 @@ where
|
|||
|
||||
// Start of code copied from rust-clippy
|
||||
|
||||
pub fn get_trait_def_id(tcx: &TyCtxt, path: &[&str], use_local: bool) -> Option<DefId> {
|
||||
if use_local {
|
||||
path_to_def_local(tcx, path)
|
||||
} else {
|
||||
path_to_def(tcx, path)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn path_to_def_local(tcx: &TyCtxt, path: &[&str]) -> Option<DefId> {
|
||||
let krate = tcx.hir.krate();
|
||||
let mut items = krate.module.item_ids.clone();
|
||||
|
|
|
@ -362,9 +362,9 @@ pub fn run_core(search_paths: SearchPaths,
|
|||
};
|
||||
|
||||
let send_trait = if crate_name == Some("core".to_string()) {
|
||||
clean::get_trait_def_id(&tcx, &["marker", "Send"], true)
|
||||
clean::path_to_def_local(&tcx, &["marker", "Send"])
|
||||
} else {
|
||||
clean::get_trait_def_id(&tcx, &["core", "marker", "Send"], false)
|
||||
clean::path_to_def(&tcx, &["core", "marker", "Send"])
|
||||
};
|
||||
|
||||
let ctxt = DocContext {
|
||||
|
@ -390,7 +390,7 @@ pub fn run_core(search_paths: SearchPaths,
|
|||
debug!("crate: {:?}", tcx.hir.krate());
|
||||
|
||||
let krate = {
|
||||
let mut v = RustdocVisitor::new(&*cstore, &ctxt);
|
||||
let mut v = RustdocVisitor::new(&ctxt);
|
||||
v.visit(tcx.hir.krate());
|
||||
v.clean(&ctxt)
|
||||
};
|
||||
|
|
|
@ -21,7 +21,6 @@ use syntax_pos::{self, Span};
|
|||
use rustc::hir::map as hir_map;
|
||||
use rustc::hir::def::Def;
|
||||
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||
use rustc::middle::cstore::CrateStore;
|
||||
use rustc::middle::privacy::AccessLevel;
|
||||
use rustc::util::nodemap::{FxHashSet, FxHashMap};
|
||||
|
||||
|
@ -40,7 +39,6 @@ use doctree::*;
|
|||
// framework from syntax?
|
||||
|
||||
pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
|
||||
pub cstore: &'a CrateStore,
|
||||
pub module: Module,
|
||||
pub attrs: hir::HirVec<ast::Attribute>,
|
||||
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
|
||||
|
@ -52,8 +50,7 @@ pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
|
||||
pub fn new(cstore: &'a CrateStore,
|
||||
cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> RustdocVisitor<'a, 'tcx, 'rcx> {
|
||||
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> RustdocVisitor<'a, 'tcx, 'rcx> {
|
||||
// If the root is re-exported, terminate all recursion.
|
||||
let mut stack = FxHashSet();
|
||||
stack.insert(ast::CRATE_NODE_ID);
|
||||
|
@ -65,7 +62,6 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
|
|||
inlining: false,
|
||||
inside_public_path: true,
|
||||
exact_paths: Some(FxHashMap()),
|
||||
cstore,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue