@@ -10,7 +10,6 @@ use rustc_middle::hir::map::Map;
1010use rustc_middle:: hir:: nested_filter;
1111use rustc_middle:: ty:: TyCtxt ;
1212use rustc_resolve:: rustdoc:: span_of_fragments;
13- use rustc_session:: Session ;
1413use rustc_span:: source_map:: SourceMap ;
1514use rustc_span:: { BytePos , DUMMY_SP , FileName , Pos , Span } ;
1615
@@ -63,30 +62,28 @@ impl DocTestVisitor for RustCollector {
6362fn visit_header ( & mut self , _name : & str , _level : u32 ) { }
6463}
6564
66- pub ( super ) struct HirCollector < ' a , ' tcx > {
67- sess : & ' a Session ,
65+ pub ( super ) struct HirCollector < ' tcx > {
6866map : Map < ' tcx > ,
6967codes : ErrorCodes ,
7068tcx : TyCtxt < ' tcx > ,
7169enable_per_target_ignores : bool ,
7270collector : RustCollector ,
7371}
7472
75- impl < ' a , ' tcx > HirCollector < ' a , ' tcx > {
73+ impl < ' tcx > HirCollector < ' tcx > {
7674pub fn new (
77- sess : & ' a Session ,
7875map : Map < ' tcx > ,
7976codes : ErrorCodes ,
8077enable_per_target_ignores : bool ,
8178tcx : TyCtxt < ' tcx > ,
8279) -> Self {
8380let collector = RustCollector {
84- source_map : sess. psess . clone_source_map ( ) ,
81+ source_map : tcx . sess . psess . clone_source_map ( ) ,
8582cur_path : vec ! [ ] ,
8683position : DUMMY_SP ,
8784tests : vec ! [ ] ,
8885} ;
89- Self { sess , map, codes, enable_per_target_ignores, tcx, collector }
86+ Self { map, codes, enable_per_target_ignores, tcx, collector }
9087}
9188
9289pub fn collect_crate ( mut self ) -> Vec < ScrapedDocTest > {
@@ -98,7 +95,7 @@ impl<'a, 'tcx> HirCollector<'a, 'tcx> {
9895}
9996}
10097
101- impl < ' a , ' tcx > HirCollector < ' a , ' tcx > {
98+ impl < ' tcx > HirCollector < ' tcx > {
10299fn visit_testable < F : FnOnce ( & mut Self ) > (
103100& mut self ,
104101name : String ,
@@ -108,7 +105,7 @@ impl<'a, 'tcx> HirCollector<'a, 'tcx> {
108105) {
109106let ast_attrs = self . tcx . hir ( ) . attrs ( self . tcx . local_def_id_to_hir_id ( def_id) ) ;
110107if let Some ( ref cfg) = ast_attrs. cfg ( self . tcx , & FxHashSet :: default ( ) ) {
111- if !cfg. matches ( & self . sess . psess , Some ( self . tcx . features ( ) ) ) {
108+ if !cfg. matches ( & self . tcx . sess . psess , Some ( self . tcx . features ( ) ) ) {
112109return ;
113110}
114111}
@@ -141,7 +138,7 @@ impl<'a, 'tcx> HirCollector<'a, 'tcx> {
141138}
142139}
143140
144- impl < ' a , ' tcx > intravisit:: Visitor < ' tcx > for HirCollector < ' a , ' tcx > {
141+ impl < ' tcx > intravisit:: Visitor < ' tcx > for HirCollector < ' tcx > {
145142type NestedFilter = nested_filter:: All ;
146143
147144fn nested_visit_map ( & mut self ) -> Self :: Map {
0 commit comments