diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index a44641f4488e8..7040106568983 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -36,8 +36,8 @@ use std::hash::Hash; use std::{mem, vec}; use crate::core::{self, DocContext, ImplTraitParam}; -use crate::doctree; use crate::formats::item_type::ItemType; +use crate::visit_ast::Module as DocModule; use utils::*; @@ -54,7 +54,7 @@ crate trait Clean { fn clean(&self, cx: &mut DocContext<'_>) -> T; } -impl Clean for doctree::Module<'_> { +impl Clean for DocModule<'_> { fn clean(&self, cx: &mut DocContext<'_>) -> Item { let mut items: Vec = vec![]; items.extend(self.foreigns.iter().map(|x| x.clean(cx))); diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs deleted file mode 100644 index 8f1e8f277c5fe..0000000000000 --- a/src/librustdoc/doctree.rs +++ /dev/null @@ -1,27 +0,0 @@ -//! This module is used to store stuff from Rust's AST in a more convenient -//! manner (and with prettier names) before cleaning. -use rustc_middle::ty::TyCtxt; -use rustc_span::{self, Span, Symbol}; - -use rustc_hir as hir; - -#[derive(Debug)] -crate struct Module<'hir> { - crate name: Symbol, - crate where_inner: Span, - crate mods: Vec>, - crate id: hir::HirId, - // (item, renamed) - crate items: Vec<(&'hir hir::Item<'hir>, Option)>, - crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option)>, -} - -impl Module<'hir> { - crate fn new(name: Symbol, id: hir::HirId, where_inner: Span) -> Module<'hir> { - Module { name, id, where_inner, mods: Vec::new(), items: Vec::new(), foreigns: Vec::new() } - } - - crate fn where_outer(&self, tcx: TyCtxt<'_>) -> Span { - tcx.hir().span(self.id) - } -} diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 1c12cc547e0da..b6311abb5c3e8 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -109,7 +109,6 @@ mod config; mod core; mod docfs; mod doctest; -mod doctree; mod error; mod externalfiles; mod fold; diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 1191a94a7039b..379de080ffd4d 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -11,12 +11,35 @@ use rustc_middle::middle::privacy::AccessLevel; use rustc_middle::ty::TyCtxt; use rustc_span::def_id::{CRATE_DEF_ID, LOCAL_CRATE}; use rustc_span::symbol::{kw, sym, Symbol}; +use rustc_span::Span; use std::mem; use crate::clean::{self, cfg::Cfg, AttributesExt, NestedAttributesExt}; use crate::core; -use crate::doctree::*; + +/// This module is used to store stuff from Rust's AST in a more convenient +/// manner (and with prettier names) before cleaning. +#[derive(Debug)] +crate struct Module<'hir> { + crate name: Symbol, + crate where_inner: Span, + crate mods: Vec>, + crate id: hir::HirId, + // (item, renamed) + crate items: Vec<(&'hir hir::Item<'hir>, Option)>, + crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option)>, +} + +impl Module<'hir> { + crate fn new(name: Symbol, id: hir::HirId, where_inner: Span) -> Module<'hir> { + Module { name, id, where_inner, mods: Vec::new(), items: Vec::new(), foreigns: Vec::new() } + } + + crate fn where_outer(&self, tcx: TyCtxt<'_>) -> Span { + tcx.hir().span(self.id) + } +} // FIXME: Should this be replaced with tcx.def_path_str? fn def_id_to_path(tcx: TyCtxt<'_>, did: DefId) -> Vec {