Delete rustdoc::doctree
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
parent
3e018ce194
commit
e7a20c96b1
4 changed files with 26 additions and 31 deletions
|
@ -36,8 +36,8 @@ use std::hash::Hash;
|
||||||
use std::{mem, vec};
|
use std::{mem, vec};
|
||||||
|
|
||||||
use crate::core::{self, DocContext, ImplTraitParam};
|
use crate::core::{self, DocContext, ImplTraitParam};
|
||||||
use crate::doctree;
|
|
||||||
use crate::formats::item_type::ItemType;
|
use crate::formats::item_type::ItemType;
|
||||||
|
use crate::visit_ast::Module as DocModule;
|
||||||
|
|
||||||
use utils::*;
|
use utils::*;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ crate trait Clean<T> {
|
||||||
fn clean(&self, cx: &mut DocContext<'_>) -> T;
|
fn clean(&self, cx: &mut DocContext<'_>) -> T;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<Item> for doctree::Module<'_> {
|
impl Clean<Item> for DocModule<'_> {
|
||||||
fn clean(&self, cx: &mut DocContext<'_>) -> Item {
|
fn clean(&self, cx: &mut DocContext<'_>) -> Item {
|
||||||
let mut items: Vec<Item> = vec![];
|
let mut items: Vec<Item> = vec![];
|
||||||
items.extend(self.foreigns.iter().map(|x| x.clean(cx)));
|
items.extend(self.foreigns.iter().map(|x| x.clean(cx)));
|
||||||
|
|
|
@ -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<Module<'hir>>,
|
|
||||||
crate id: hir::HirId,
|
|
||||||
// (item, renamed)
|
|
||||||
crate items: Vec<(&'hir hir::Item<'hir>, Option<Symbol>)>,
|
|
||||||
crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Symbol>)>,
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -109,7 +109,6 @@ mod config;
|
||||||
mod core;
|
mod core;
|
||||||
mod docfs;
|
mod docfs;
|
||||||
mod doctest;
|
mod doctest;
|
||||||
mod doctree;
|
|
||||||
mod error;
|
mod error;
|
||||||
mod externalfiles;
|
mod externalfiles;
|
||||||
mod fold;
|
mod fold;
|
||||||
|
|
|
@ -11,12 +11,35 @@ use rustc_middle::middle::privacy::AccessLevel;
|
||||||
use rustc_middle::ty::TyCtxt;
|
use rustc_middle::ty::TyCtxt;
|
||||||
use rustc_span::def_id::{CRATE_DEF_ID, LOCAL_CRATE};
|
use rustc_span::def_id::{CRATE_DEF_ID, LOCAL_CRATE};
|
||||||
use rustc_span::symbol::{kw, sym, Symbol};
|
use rustc_span::symbol::{kw, sym, Symbol};
|
||||||
|
use rustc_span::Span;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
|
||||||
use crate::clean::{self, cfg::Cfg, AttributesExt, NestedAttributesExt};
|
use crate::clean::{self, cfg::Cfg, AttributesExt, NestedAttributesExt};
|
||||||
use crate::core;
|
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<Module<'hir>>,
|
||||||
|
crate id: hir::HirId,
|
||||||
|
// (item, renamed)
|
||||||
|
crate items: Vec<(&'hir hir::Item<'hir>, Option<Symbol>)>,
|
||||||
|
crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Symbol>)>,
|
||||||
|
}
|
||||||
|
|
||||||
|
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?
|
// FIXME: Should this be replaced with tcx.def_path_str?
|
||||||
fn def_id_to_path(tcx: TyCtxt<'_>, did: DefId) -> Vec<String> {
|
fn def_id_to_path(tcx: TyCtxt<'_>, did: DefId) -> Vec<String> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue