@@ -887,7 +887,7 @@ pub enum ErrorOutputType {
887887 /// Output meant for the consumption of humans.
888888 #[ default]
889889 HumanReadable {
890- kind : HumanReadableErrorType = HumanReadableErrorType { short : false , unicode : false } ,
890+ kind : HumanReadableErrorType = HumanReadableErrorType { no_graphics : false , short : false , unicode : false } ,
891891 color_config: ColorConfig = ColorConfig :: Auto ,
892892 } ,
893893 /// Output that's consumed by other tools such as `rustfix` or the `RLS`.
@@ -2337,7 +2337,8 @@ impl JsonUnusedExterns {
23372337/// The first value returned is how to render JSON diagnostics, and the second
23382338/// is whether or not artifact notifications are enabled.
23392339pub fn parse_json ( early_dcx : & EarlyDiagCtxt , matches : & getopts:: Matches ) -> JsonConfig {
2340- let mut json_rendered = HumanReadableErrorType { short : false , unicode : false } ;
2340+ let mut json_rendered =
2341+ HumanReadableErrorType { no_graphics : false , short : false , unicode : false } ;
23412342 let mut json_color = ColorConfig :: Never ;
23422343 let mut json_artifact_notifications = false ;
23432344 let mut json_unused_externs = JsonUnusedExterns :: No ;
@@ -2354,10 +2355,16 @@ pub fn parse_json(early_dcx: &EarlyDiagCtxt, matches: &getopts::Matches) -> Json
23542355 for sub_option in option. split ( ',' ) {
23552356 match sub_option {
23562357 "diagnostic-short" => {
2357- json_rendered = HumanReadableErrorType { short : true , unicode : false } ;
2358+ json_rendered =
2359+ HumanReadableErrorType { no_graphics : false , short : true , unicode : false } ;
2360+ }
2361+ "diagnostic-no-graphics" => {
2362+ json_rendered =
2363+ HumanReadableErrorType { no_graphics : true , short : false , unicode : false } ;
23582364 }
23592365 "diagnostic-unicode" => {
2360- json_rendered = HumanReadableErrorType { short : false , unicode : true } ;
2366+ json_rendered =
2367+ HumanReadableErrorType { no_graphics : false , short : false , unicode : true } ;
23612368 }
23622369 "diagnostic-rendered-ansi" => json_color = ColorConfig :: Always ,
23632370 "artifacts" => json_artifact_notifications = true ,
@@ -2388,7 +2395,7 @@ pub fn parse_error_format(
23882395 json_color : ColorConfig ,
23892396 json_rendered : HumanReadableErrorType ,
23902397) -> ErrorOutputType {
2391- let default_kind = HumanReadableErrorType { short : false , unicode : false } ;
2398+ let default_kind = HumanReadableErrorType { no_graphics : false , short : false , unicode : false } ;
23922399 // We need the `opts_present` check because the driver will send us Matches
23932400 // with only stable options if no unstable options are used. Since error-format
23942401 // is unstable, it will not be present. We have to use `opts_present` not
@@ -2405,11 +2412,15 @@ pub fn parse_error_format(
24052412 ErrorOutputType :: Json { pretty : true , json_rendered, color_config : json_color }
24062413 }
24072414 Some ( "short" ) => ErrorOutputType :: HumanReadable {
2408- kind : HumanReadableErrorType { short : true , unicode : false } ,
2415+ kind : HumanReadableErrorType { no_graphics : false , short : true , unicode : false } ,
2416+ color_config,
2417+ } ,
2418+ Some ( "human-no-graphics" ) => ErrorOutputType :: HumanReadable {
2419+ kind : HumanReadableErrorType { no_graphics : true , short : false , unicode : false } ,
24092420 color_config,
24102421 } ,
24112422 Some ( "human-unicode" ) => ErrorOutputType :: HumanReadable {
2412- kind : HumanReadableErrorType { short : false , unicode : true } ,
2423+ kind : HumanReadableErrorType { no_graphics : false , short : false , unicode : true } ,
24132424 color_config,
24142425 } ,
24152426 Some ( arg) => {
@@ -2418,8 +2429,8 @@ pub fn parse_error_format(
24182429 kind : default_kind,
24192430 } ) ;
24202431 early_dcx. early_fatal ( format ! (
2421- "argument for `--error-format` must be `human`, `human-unicode `, \
2422- `json`, `pretty-json` or `short` (instead was `{arg}`)"
2432+ "argument for `--error-format` must be `human`, `human-no-graphics `, \
2433+ `human-unicode`, ` json`, `pretty-json` or `short` (instead was `{arg}`)"
24232434 ) )
24242435 }
24252436 }
@@ -2494,6 +2505,7 @@ fn check_error_format_stability(
24942505 let format = match format {
24952506 ErrorOutputType :: Json { pretty : true , .. } => "pretty-json" ,
24962507 ErrorOutputType :: HumanReadable { kind, .. } => match kind {
2508+ HumanReadableErrorType { no_graphics : true , .. } => "human-no-graphics" ,
24972509 HumanReadableErrorType { unicode : true , .. } => "human-unicode" ,
24982510 _ => return ,
24992511 } ,
0 commit comments