Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,18 @@ impl Options {
}
}

if output_format == OutputFormat::Json {
if let Some(emit_flag) = emit.iter().find_map(|emit| match emit {
EmitType::HtmlStaticFiles => Some("html-static-files"),
EmitType::HtmlNonStaticFiles => Some("html-non-static-files"),
EmitType::DepInfo(_) => None,
}) {
dcx.fatal(format!(
"the `--emit={emit_flag}` flag is not supported with `--output-format=json`",
));
}
}

let to_check = matches.opt_strs("check-theme");
if !to_check.is_empty() {
let mut content =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: the `--emit=html-non-static-files` flag is not supported with `--output-format=json`

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: the `--emit=html-static-files` flag is not supported with `--output-format=json`

8 changes: 8 additions & 0 deletions tests/rustdoc-ui/output-format-json-emit-html.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ revisions: html_static html_non_static
//@ check-fail
//@[html_static] compile-flags: -Z unstable-options --output-format=json --emit=html-static-files
//@[html_non_static] compile-flags: -Z unstable-options --output-format=json --emit=html-non-static-files
//[html_static]~? ERROR the `--emit=html-static-files` flag is not supported with `--output-format=json`
//[html_non_static]~? ERROR the `--emit=html-non-static-files` flag is not supported with `--output-format=json`

pub struct Foo;
5 changes: 5 additions & 0 deletions tests/rustdoc-ui/show-coverage-json-emit-html-non-static.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ compile-flags: -Z unstable-options --show-coverage --output-format=json --emit=html-non-static-files
//@ check-fail
//~? ERROR the `--emit=html-non-static-files` flag is not supported with `--output-format=json`

pub struct Foo;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: the `--emit=html-non-static-files` flag is not supported with `--output-format=json`

Loading