@@ -44,7 +44,6 @@ use rustc_target::spec::{
44
44
use std:: cell:: { self , RefCell } ;
45
45
use std:: env;
46
46
use std:: fmt;
47
- use std:: io:: Write ;
48
47
use std:: ops:: { Div , Mul } ;
49
48
use std:: path:: { Path , PathBuf } ;
50
49
use std:: str:: FromStr ;
@@ -1213,11 +1212,10 @@ fn default_emitter(
1213
1212
source_map : Lrc < SourceMap > ,
1214
1213
bundle : Option < Lrc < FluentBundle > > ,
1215
1214
fallback_bundle : LazyFallbackBundle ,
1216
- emitter_dest : Option < Box < dyn Write + Send > > ,
1217
1215
) -> Box < dyn Emitter + sync:: Send > {
1218
1216
let macro_backtrace = sopts. unstable_opts . macro_backtrace ;
1219
- match ( sopts. error_format , emitter_dest ) {
1220
- ( config:: ErrorOutputType :: HumanReadable ( kind) , dst ) => {
1217
+ match sopts. error_format {
1218
+ config:: ErrorOutputType :: HumanReadable ( kind) => {
1221
1219
let ( short, color_config) = kind. unzip ( ) ;
1222
1220
1223
1221
if let HumanReadableErrorType :: AnnotateSnippet ( _) = kind {
@@ -1230,33 +1228,20 @@ fn default_emitter(
1230
1228
) ;
1231
1229
Box :: new ( emitter. ui_testing ( sopts. unstable_opts . ui_testing ) )
1232
1230
} else {
1233
- let emitter = match dst {
1234
- None => EmitterWriter :: stderr (
1235
- color_config,
1236
- Some ( source_map) ,
1237
- bundle,
1238
- fallback_bundle,
1239
- short,
1240
- sopts. unstable_opts . teach ,
1241
- sopts. diagnostic_width ,
1242
- macro_backtrace,
1243
- ) ,
1244
- Some ( dst) => EmitterWriter :: new (
1245
- dst,
1246
- Some ( source_map) ,
1247
- bundle,
1248
- fallback_bundle,
1249
- short,
1250
- false , // no teach messages when writing to a buffer
1251
- false , // no colors when writing to a buffer
1252
- None , // no diagnostic width
1253
- macro_backtrace,
1254
- ) ,
1255
- } ;
1231
+ let emitter = EmitterWriter :: stderr (
1232
+ color_config,
1233
+ Some ( source_map) ,
1234
+ bundle,
1235
+ fallback_bundle,
1236
+ short,
1237
+ sopts. unstable_opts . teach ,
1238
+ sopts. diagnostic_width ,
1239
+ macro_backtrace,
1240
+ ) ;
1256
1241
Box :: new ( emitter. ui_testing ( sopts. unstable_opts . ui_testing ) )
1257
1242
}
1258
1243
}
1259
- ( config:: ErrorOutputType :: Json { pretty, json_rendered } , None ) => Box :: new (
1244
+ config:: ErrorOutputType :: Json { pretty, json_rendered } => Box :: new (
1260
1245
JsonEmitter :: stderr (
1261
1246
Some ( registry) ,
1262
1247
source_map,
@@ -1269,36 +1254,16 @@ fn default_emitter(
1269
1254
)
1270
1255
. ui_testing ( sopts. unstable_opts . ui_testing ) ,
1271
1256
) ,
1272
- ( config:: ErrorOutputType :: Json { pretty, json_rendered } , Some ( dst) ) => Box :: new (
1273
- JsonEmitter :: new (
1274
- dst,
1275
- Some ( registry) ,
1276
- source_map,
1277
- bundle,
1278
- fallback_bundle,
1279
- pretty,
1280
- json_rendered,
1281
- sopts. diagnostic_width ,
1282
- macro_backtrace,
1283
- )
1284
- . ui_testing ( sopts. unstable_opts . ui_testing ) ,
1285
- ) ,
1286
1257
}
1287
1258
}
1288
1259
1289
- pub enum DiagnosticOutput {
1290
- Default ,
1291
- Raw ( Box < dyn Write + Send > ) ,
1292
- }
1293
-
1294
1260
// JUSTIFICATION: literally session construction
1295
1261
#[ allow( rustc:: bad_opt_access) ]
1296
1262
pub fn build_session (
1297
1263
sopts : config:: Options ,
1298
1264
local_crate_source_file : Option < PathBuf > ,
1299
1265
bundle : Option < Lrc < rustc_errors:: FluentBundle > > ,
1300
1266
registry : rustc_errors:: registry:: Registry ,
1301
- diagnostics_output : DiagnosticOutput ,
1302
1267
driver_lint_caps : FxHashMap < lint:: LintId , lint:: Level > ,
1303
1268
file_loader : Option < Box < dyn FileLoader + Send + Sync + ' static > > ,
1304
1269
target_override : Option < Target > ,
@@ -1314,11 +1279,6 @@ pub fn build_session(
1314
1279
let cap_lints_allow = sopts. lint_cap . map_or ( false , |cap| cap == lint:: Allow ) ;
1315
1280
let can_emit_warnings = !( warnings_allow || cap_lints_allow) ;
1316
1281
1317
- let write_dest = match diagnostics_output {
1318
- DiagnosticOutput :: Default => None ,
1319
- DiagnosticOutput :: Raw ( write) => Some ( write) ,
1320
- } ;
1321
-
1322
1282
let sysroot = match & sopts. maybe_sysroot {
1323
1283
Some ( sysroot) => sysroot. clone ( ) ,
1324
1284
None => filesearch:: get_or_default_sysroot ( ) ,
@@ -1351,8 +1311,7 @@ pub fn build_session(
1351
1311
rustc_errors:: DEFAULT_LOCALE_RESOURCES ,
1352
1312
sopts. unstable_opts . translate_directionality_markers ,
1353
1313
) ;
1354
- let emitter =
1355
- default_emitter ( & sopts, registry, source_map. clone ( ) , bundle, fallback_bundle, write_dest) ;
1314
+ let emitter = default_emitter ( & sopts, registry, source_map. clone ( ) , bundle, fallback_bundle) ;
1356
1315
1357
1316
let span_diagnostic = rustc_errors:: Handler :: with_emitter_and_flags (
1358
1317
emitter,
0 commit comments