@@ -10,7 +10,6 @@ use rustc_middle::hir::map::Map;
10
10
use rustc_middle:: hir:: nested_filter;
11
11
use rustc_middle:: ty:: TyCtxt ;
12
12
use rustc_resolve:: rustdoc:: span_of_fragments;
13
- use rustc_session:: Session ;
14
13
use rustc_span:: source_map:: SourceMap ;
15
14
use rustc_span:: { BytePos , DUMMY_SP , FileName , Pos , Span } ;
16
15
@@ -63,30 +62,28 @@ impl DocTestVisitor for RustCollector {
63
62
fn visit_header ( & mut self , _name : & str , _level : u32 ) { }
64
63
}
65
64
66
- pub ( super ) struct HirCollector < ' a , ' tcx > {
67
- sess : & ' a Session ,
65
+ pub ( super ) struct HirCollector < ' tcx > {
68
66
map : Map < ' tcx > ,
69
67
codes : ErrorCodes ,
70
68
tcx : TyCtxt < ' tcx > ,
71
69
enable_per_target_ignores : bool ,
72
70
collector : RustCollector ,
73
71
}
74
72
75
- impl < ' a , ' tcx > HirCollector < ' a , ' tcx > {
73
+ impl < ' tcx > HirCollector < ' tcx > {
76
74
pub fn new (
77
- sess : & ' a Session ,
78
75
map : Map < ' tcx > ,
79
76
codes : ErrorCodes ,
80
77
enable_per_target_ignores : bool ,
81
78
tcx : TyCtxt < ' tcx > ,
82
79
) -> Self {
83
80
let collector = RustCollector {
84
- source_map : sess. psess . clone_source_map ( ) ,
81
+ source_map : tcx . sess . psess . clone_source_map ( ) ,
85
82
cur_path : vec ! [ ] ,
86
83
position : DUMMY_SP ,
87
84
tests : vec ! [ ] ,
88
85
} ;
89
- Self { sess , map, codes, enable_per_target_ignores, tcx, collector }
86
+ Self { map, codes, enable_per_target_ignores, tcx, collector }
90
87
}
91
88
92
89
pub fn collect_crate ( mut self ) -> Vec < ScrapedDocTest > {
@@ -98,7 +95,7 @@ impl<'a, 'tcx> HirCollector<'a, 'tcx> {
98
95
}
99
96
}
100
97
101
- impl < ' a , ' tcx > HirCollector < ' a , ' tcx > {
98
+ impl < ' tcx > HirCollector < ' tcx > {
102
99
fn visit_testable < F : FnOnce ( & mut Self ) > (
103
100
& mut self ,
104
101
name : String ,
@@ -108,7 +105,7 @@ impl<'a, 'tcx> HirCollector<'a, 'tcx> {
108
105
) {
109
106
let ast_attrs = self . tcx . hir ( ) . attrs ( self . tcx . local_def_id_to_hir_id ( def_id) ) ;
110
107
if 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 ( ) ) ) {
112
109
return ;
113
110
}
114
111
}
@@ -141,7 +138,7 @@ impl<'a, 'tcx> HirCollector<'a, 'tcx> {
141
138
}
142
139
}
143
140
144
- impl < ' a , ' tcx > intravisit:: Visitor < ' tcx > for HirCollector < ' a , ' tcx > {
141
+ impl < ' tcx > intravisit:: Visitor < ' tcx > for HirCollector < ' tcx > {
145
142
type NestedFilter = nested_filter:: All ;
146
143
147
144
fn nested_visit_map ( & mut self ) -> Self :: Map {
0 commit comments