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
6 changes: 5 additions & 1 deletion src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,13 @@ impl Options {
return None;
}

let should_test = matches.opt_present("test");

let mut emit = FxIndexMap::<_, EmitType>::default();
for list in matches.opt_strs("emit") {
if should_test {
dcx.fatal("the `--test` flag and the `--emit` flag are not supported together");
}
for kind in list.split(',') {
match kind.parse() {
Ok(kind) => {
Expand Down Expand Up @@ -634,7 +639,6 @@ impl Options {
let test_args: Vec<String> =
test_args.iter().flat_map(|s| s.split_whitespace()).map(|s| s.to_string()).collect();

let should_test = matches.opt_present("test");
let no_run = matches.opt_present("no-run");

if !should_test && no_run {
Expand Down
5 changes: 5 additions & 0 deletions tests/rustdoc-ui/doctest/emit-test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
//@ compile-flags:--test --emit=dep-info -Z unstable-options
//@ check-fail
//~? ERROR the `--test` flag and the `--emit` flag

//! This example intentionally left blank.
2 changes: 2 additions & 0 deletions tests/rustdoc-ui/doctest/emit-test.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
error: the `--test` flag and the `--emit` flag are not supported together

Loading