@@ -11,12 +11,35 @@ use rustc_middle::middle::privacy::AccessLevel;
11
11
use rustc_middle:: ty:: TyCtxt ;
12
12
use rustc_span:: def_id:: { CRATE_DEF_ID , LOCAL_CRATE } ;
13
13
use rustc_span:: symbol:: { kw, sym, Symbol } ;
14
+ use rustc_span:: Span ;
14
15
15
16
use std:: mem;
16
17
17
18
use crate :: clean:: { self , cfg:: Cfg , AttributesExt , NestedAttributesExt } ;
18
19
use 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
+ }
20
43
21
44
// FIXME: Should this be replaced with tcx.def_path_str?
22
45
fn def_id_to_path ( tcx : TyCtxt < ' _ > , did : DefId ) -> Vec < String > {
0 commit comments