mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
error when --no-run is present without --test
This commit is contained in:
parent
202659a43d
commit
3273d2f719
@ -459,6 +459,12 @@ impl Options {
|
||||
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 {
|
||||
diag.struct_err("option --no-run should be used with --test").emit();
|
||||
return Err(1);
|
||||
}
|
||||
|
||||
let output =
|
||||
matches.opt_str("o").map(|s| PathBuf::from(&s)).unwrap_or_else(|| PathBuf::from("doc"));
|
||||
@ -629,7 +635,6 @@ impl Options {
|
||||
let document_hidden = matches.opt_present("document-hidden-items");
|
||||
let run_check = matches.opt_present("check");
|
||||
let generate_redirect_map = matches.opt_present("generate-redirect-map");
|
||||
let no_run = matches.opt_present("no-run");
|
||||
|
||||
let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format);
|
||||
|
||||
|
5
src/test/rustdoc-ui/no-run-flag-error.rs
Normal file
5
src/test/rustdoc-ui/no-run-flag-error.rs
Normal file
@ -0,0 +1,5 @@
|
||||
// test the behavior of the --no-run flag without the --test flag
|
||||
|
||||
// compile-flags:-Z unstable-options --no-run --test-args=--test-threads=1
|
||||
|
||||
pub fn f() {}
|
2
src/test/rustdoc-ui/no-run-flag-error.stderr
Normal file
2
src/test/rustdoc-ui/no-run-flag-error.stderr
Normal file
@ -0,0 +1,2 @@
|
||||
error: option --no-run should be used with --test
|
||||
|
Loading…
Reference in New Issue
Block a user