|
1 | 1 | use rustc_ast as ast;
|
2 | 2 | use rustc_data_structures::sync::Lrc;
|
3 |
| -use rustc_errors::ErrorReported; |
| 3 | +use rustc_errors::{ColorConfig, ErrorReported}; |
| 4 | +use rustc_feature::UnstableFeatures; |
4 | 5 | use rustc_hir as hir;
|
5 | 6 | use rustc_hir::intravisit;
|
6 | 7 | use rustc_hir::{HirId, CRATE_HIR_ID};
|
7 | 8 | use rustc_interface::interface;
|
8 | 9 | use rustc_middle::hir::map::Map;
|
9 | 10 | use rustc_middle::ty::TyCtxt;
|
10 |
| -use rustc_session::config::{self, CrateType}; |
| 11 | +use rustc_session::config::{self, CrateType, ErrorOutputType}; |
11 | 12 | use rustc_session::{lint, DiagnosticOutput, Session};
|
12 | 13 | use rustc_span::edition::Edition;
|
13 | 14 | use rustc_span::source_map::SourceMap;
|
@@ -293,6 +294,18 @@ fn run_test(
|
293 | 294 | path.to_str().expect("target path must be valid unicode").to_string()
|
294 | 295 | }
|
295 | 296 | });
|
| 297 | + match options.error_format { |
| 298 | + ErrorOutputType::HumanReadable(kind) => { |
| 299 | + let (_, color_config) = kind.unzip(); |
| 300 | + match color_config { |
| 301 | + ColorConfig::Never => {} |
| 302 | + _ => { |
| 303 | + compiler.arg("--color").arg("always"); |
| 304 | + } |
| 305 | + } |
| 306 | + } |
| 307 | + _ => {} |
| 308 | + } |
296 | 309 |
|
297 | 310 | compiler.arg("-");
|
298 | 311 | compiler.stdin(Stdio::piped());
|
|
0 commit comments