1
Fork 0
rust/compiler/rustc_session/src
Nicholas Nethercote 8843223897 Change printing of "--error-format is unstable" errors.
Currently for these two errors we go to the effort of switching to a
standard JSON emitter, for no obvious reason, and unlike any other
errors. This behaviour was added for `pretty-json` in #45737, and then
`human-annotate-rs` copied it some time later when it was added.

This commit changes things to just using the requested emitter, which is
simpler and consistent with other errors.

Old output:
```
$ rustc --error-format pretty-json
{"$message_type":"diagnostic","message":"`--error-format=pretty-json` is unstable","code":null,"level":"error","spans":[],"children":[],"rendered":"error: `--error-format=pretty-json` is unstable\n\n"}

$ rustc --error-format human-annotate-rs
{"$message_type":"diagnostic","message":"`--error-format=human-annotate-rs` is unstable","code":null,"level":"error","spans":[],"children":[],"rendered":"error: `--error-format=human-annotate-rs` is unstable\n\n"}
```

New output:
```
$ rustc --error-format pretty-json
{
  "$message_type": "diagnostic",
  "message": "`--error-format=pretty-json` is unstable",
  "code": null,
  "level": "error",
  "spans": [],
  "children": [],
  "rendered": "error: `--error-format=pretty-json` is unstable\n\n"
}

$ rustc --error-format human-annotate-rs
error: `--error-format=human-annotate-rs` is unstable
```
2024-01-05 14:37:06 +11:00
..
config Change process spawning to inherit the parent's signal mask by default 2022-10-20 14:53:38 -07:00
code_stats.rs rustc_session: Address all rustc::potential_query_instability lints 2023-12-03 15:05:39 +01:00
config.rs Change printing of "--error-format is unstable" errors. 2024-01-05 14:37:06 +11:00
cstore.rs Move MetadataLoader{,Dyn} to rustc_metadata. 2023-11-30 17:05:54 +11:00
errors.rs Remove ParseSess methods that duplicate DiagCtxt methods. 2023-12-24 07:59:21 +11:00
filesearch.rs Remove unused FileMatch. 2023-11-30 17:05:56 +11:00
lib.rs rustc_session: Address all rustc::potential_query_instability lints 2023-12-03 15:05:39 +01:00
options.rs Auto merge of #119129 - jyn514:verbose, r=compiler-errors,estebank 2023-12-26 12:27:29 +00:00
output.rs Remove more Session methods that duplicate DiagCtxt methods. 2023-12-24 08:17:47 +11:00
parse.rs Remove ParseSess methods that duplicate DiagCtxt methods. 2023-12-24 07:59:21 +11:00
search_paths.rs Rename EarlyDiagCtxt methods to match DiagCtxt. 2023-12-23 13:23:28 +11:00
session.rs Rename AnnotateSnippetEmitterWriter as AnnotateSnippetEmitter. 2024-01-05 10:37:44 +11:00
utils.rs Move is_ascii_ident to where it's used. 2023-11-30 17:05:56 +11:00
version.rs Simplify the current_rustc_version macro. 2023-11-10 10:54:21 +11:00