@@ -35,7 +35,7 @@ use crate::html::render::RenderInfo;
35
35
36
36
use crate :: passes;
37
37
38
- pub use rustc:: session:: config:: { CodegenOptions , Input , Options } ;
38
+ pub use rustc:: session:: config:: { CodegenOptions , DebuggingOptions , Input , Options } ;
39
39
pub use rustc:: session:: search_paths:: SearchPath ;
40
40
41
41
pub type ExternalPaths = FxHashMap < DefId , ( Vec < String > , clean:: TypeKind ) > ;
@@ -170,12 +170,8 @@ impl<'tcx> DocContext<'tcx> {
170
170
pub fn new_handler (
171
171
error_format : ErrorOutputType ,
172
172
source_map : Option < Lrc < source_map:: SourceMap > > ,
173
- treat_err_as_bug : Option < usize > ,
174
- ui_testing : bool ,
173
+ debugging_opts : & DebuggingOptions ,
175
174
) -> errors:: Handler {
176
- // rustdoc doesn't override (or allow to override) anything from this that is relevant here, so
177
- // stick to the defaults
178
- let sessopts = Options :: default ( ) ;
179
175
let emitter: Box < dyn Emitter + sync:: Send > = match error_format {
180
176
ErrorOutputType :: HumanReadable ( kind) => {
181
177
let ( short, color_config) = kind. unzip ( ) ;
@@ -184,34 +180,25 @@ pub fn new_handler(
184
180
color_config,
185
181
source_map. map ( |cm| cm as _ ) ,
186
182
short,
187
- sessopts . debugging_opts . teach ,
188
- sessopts . debugging_opts . terminal_width ,
183
+ debugging_opts. teach ,
184
+ debugging_opts. terminal_width ,
189
185
false ,
190
186
)
191
- . ui_testing ( ui_testing) ,
187
+ . ui_testing ( debugging_opts . ui_testing ) ,
192
188
)
193
189
}
194
190
ErrorOutputType :: Json { pretty, json_rendered } => {
195
191
let source_map = source_map. unwrap_or_else ( || {
196
- Lrc :: new ( source_map:: SourceMap :: new ( sessopts . file_path_mapping ( ) ) )
192
+ Lrc :: new ( source_map:: SourceMap :: new ( source_map :: FilePathMapping :: empty ( ) ) )
197
193
} ) ;
198
194
Box :: new (
199
195
JsonEmitter :: stderr ( None , source_map, pretty, json_rendered, false )
200
- . ui_testing ( ui_testing) ,
196
+ . ui_testing ( debugging_opts . ui_testing ) ,
201
197
)
202
198
}
203
199
} ;
204
200
205
- errors:: Handler :: with_emitter_and_flags (
206
- emitter,
207
- errors:: HandlerFlags {
208
- can_emit_warnings : true ,
209
- treat_err_as_bug,
210
- report_delayed_bugs : false ,
211
- external_macro_backtrace : false ,
212
- ..Default :: default ( )
213
- } ,
214
- )
201
+ errors:: Handler :: with_emitter_and_flags ( emitter, debugging_opts. diagnostic_handler_flags ( true ) )
215
202
}
216
203
217
204
pub fn run_core ( options : RustdocOptions ) -> ( clean:: Crate , RenderInfo , RenderOptions ) {
0 commit comments