Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc rustdoc changes #52211

Merged
merged 1 commit into from
Jul 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4318,14 +4318,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();
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,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 {
Expand All @@ -387,7 +387,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)
};
Expand Down
6 changes: 1 addition & 5 deletions src/librustdoc/visit_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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>,
Expand All @@ -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);
Expand All @@ -65,7 +62,6 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
inlining: false,
inside_public_path: true,
exact_paths: Some(FxHashMap()),
cstore,
}
}

Expand Down