You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of #82497 - jyn514:json, r=CraftSpider
Fix handling of `--output-format json` flag
- Don't treat it as deprecated on stable and beta channels. Before, it
would give confusing and incorrect output:
```
warning: the 'output-format' flag is considered deprecated
|
= warning: see issue #44136 <#44136> for more information
error: json output format isn't supported for doc generation
```
Both of those are wrong: output-format isn't deprecated, and json
output is supported.
- Require -Z unstable-options for `--output-format json`
Previously, it was allowed by default on nightly, which made it hard
to realize the flag wouldn't be accepted on beta or stable.
To get the test working I had to remove `-Z unstable-options`, which x.py passed to compiletest unconditionally. It was first added in 8c2ec68 so `-Z miri` would be allowed. -Z miri is no longer passed unconditionally, so hopefully removing it won't break anything.
r? ```@aDotInTheVoid``` cc ```@HeroicKatora``` ```@CraftSpider```
Thanks to ```@memoryruins``` for pointing it out on Discord!
cc ```@Mark-Simulacrum``` for the change to compiletest.
Copy file name to clipboardExpand all lines: src/librustdoc/config.rs
+13-14
Original file line number
Diff line number
Diff line change
@@ -378,6 +378,17 @@ impl Options {
378
378
}
379
379
}
380
380
381
+
// check for `--output-format=json`
382
+
if !matches!(matches.opt_str("output-format").as_deref(),None | Some("html"))
383
+
&& !matches.opt_present("show-coverage")
384
+
&& !nightly_options::is_unstable_enabled(matches)
385
+
{
386
+
rustc_session::early_error(
387
+
error_format,
388
+
"the -Z unstable-options flag must be passed to enable --output-format for documentation generation (see https://github.com/rust-lang/rust/issues/76578)",
389
+
);
390
+
}
391
+
381
392
let to_check = matches.opt_strs("check-theme");
382
393
if !to_check.is_empty(){
383
394
let paths = theme::load_css_paths(static_files::themes::LIGHT.as_bytes());
@@ -574,13 +585,7 @@ impl Options {
574
585
let output_format = match matches.opt_str("output-format"){
error: the -Z unstable-options flag must be passed to enable --output-format for documentation generation (see https://github.com/rust-lang/rust/issues/76578)
0 commit comments