@@ -11,12 +11,35 @@ use rustc_middle::middle::privacy::AccessLevel;
1111use rustc_middle:: ty:: TyCtxt ;
1212use rustc_span:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE } ;
1313use rustc_span:: symbol:: { kw, sym, Symbol } ;
14+ use rustc_span:: Span ;
1415
1516use std:: mem;
1617
1718use crate :: clean:: { self , cfg:: Cfg , AttributesExt , NestedAttributesExt } ;
1819use crate :: core;
19- use crate :: doctree:: * ;
20+
21+ /// This module is used to store stuff from Rust's AST in a more convenient
22+ /// manner (and with prettier names) before cleaning.
23+ #[ derive( Debug ) ]
24+ crate struct Module < ' hir > {
25+ crate name : Symbol ,
26+ crate where_inner : Span ,
27+ crate mods : Vec < Module < ' hir > > ,
28+ crate id : hir:: HirId ,
29+ // (item, renamed)
30+ crate items : Vec < ( & ' hir hir:: Item < ' hir > , Option < Symbol > ) > ,
31+ crate foreigns : Vec < ( & ' hir hir:: ForeignItem < ' hir > , Option < Symbol > ) > ,
32+ }
33+
34+ impl Module < ' hir > {
35+ crate fn new ( name : Symbol , id : hir:: HirId , where_inner : Span ) -> Module < ' hir > {
36+ Module { name, id, where_inner, mods : Vec :: new ( ) , items : Vec :: new ( ) , foreigns : Vec :: new ( ) }
37+ }
38+
39+ crate fn where_outer ( & self , tcx : TyCtxt < ' _ > ) -> Span {
40+ tcx. hir ( ) . span ( self . id )
41+ }
42+ }
2043
2144// FIXME: Should this be replaced with tcx.def_path_str?
2245fn def_id_to_path ( tcx : TyCtxt < ' _ > , did : DefId ) -> Vec < String > {
0 commit comments