@@ -35,7 +35,7 @@ use crate::html::render::RenderInfo;
3535
3636use crate :: passes;
3737
38- pub use rustc:: session:: config:: { CodegenOptions , Input , Options } ;
38+ pub use rustc:: session:: config:: { CodegenOptions , DebuggingOptions , Input , Options } ;
3939pub use rustc:: session:: search_paths:: SearchPath ;
4040
4141pub type ExternalPaths = FxHashMap < DefId , ( Vec < String > , clean:: TypeKind ) > ;
@@ -170,12 +170,8 @@ impl<'tcx> DocContext<'tcx> {
170170pub fn new_handler (
171171 error_format : ErrorOutputType ,
172172 source_map : Option < Lrc < source_map:: SourceMap > > ,
173- treat_err_as_bug : Option < usize > ,
174- ui_testing : bool ,
173+ debugging_opts : & DebuggingOptions ,
175174) -> 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 ( ) ;
179175 let emitter: Box < dyn Emitter + sync:: Send > = match error_format {
180176 ErrorOutputType :: HumanReadable ( kind) => {
181177 let ( short, color_config) = kind. unzip ( ) ;
@@ -184,34 +180,25 @@ pub fn new_handler(
184180 color_config,
185181 source_map. map ( |cm| cm as _ ) ,
186182 short,
187- sessopts . debugging_opts . teach ,
188- sessopts . debugging_opts . terminal_width ,
183+ debugging_opts. teach ,
184+ debugging_opts. terminal_width ,
189185 false ,
190186 )
191- . ui_testing ( ui_testing) ,
187+ . ui_testing ( debugging_opts . ui_testing ) ,
192188 )
193189 }
194190 ErrorOutputType :: Json { pretty, json_rendered } => {
195191 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 ( ) ) )
197193 } ) ;
198194 Box :: new (
199195 JsonEmitter :: stderr ( None , source_map, pretty, json_rendered, false )
200- . ui_testing ( ui_testing) ,
196+ . ui_testing ( debugging_opts . ui_testing ) ,
201197 )
202198 }
203199 } ;
204200
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 ) )
215202}
216203
217204pub fn run_core ( options : RustdocOptions ) -> ( clean:: Crate , RenderInfo , RenderOptions ) {
0 commit comments