]> git.lizzy.rs Git - rust.git/blob - src/librustdoc/doctree.rs
Move `scripts` on the rustdoc template into `head` and apply the `defer` attribute
[rust.git] / src / librustdoc / doctree.rs
1 //! This module is used to store stuff from Rust's AST in a more convenient
2 //! manner (and with prettier names) before cleaning.
3 use rustc_middle::ty::TyCtxt;
4 use rustc_span::{self, Span, Symbol};
5
6 use rustc_hir as hir;
7
8 #[derive(Debug)]
9 crate struct Module<'hir> {
10     crate name: Symbol,
11     crate where_inner: Span,
12     crate mods: Vec<Module<'hir>>,
13     crate id: hir::HirId,
14     // (item, renamed)
15     crate items: Vec<(&'hir hir::Item<'hir>, Option<Symbol>)>,
16     crate foreigns: Vec<(&'hir hir::ForeignItem<'hir>, Option<Symbol>)>,
17 }
18
19 impl Module<'hir> {
20     crate fn new(name: Symbol, id: hir::HirId, where_inner: Span) -> Module<'hir> {
21         Module { name, id, where_inner, mods: Vec::new(), items: Vec::new(), foreigns: Vec::new() }
22     }
23
24     crate fn where_outer(&self, tcx: TyCtxt<'_>) -> Span {
25         tcx.hir().span(self.id)
26     }
27 }