mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Ensure that --generate-link-to-definition is only used with HTML output and is unstable
This commit is contained in:
parent
2104bf27d4
commit
83dcd30ee0
@ -659,6 +659,14 @@ impl Options {
|
||||
let nocapture = matches.opt_present("nocapture");
|
||||
let generate_link_to_definition = matches.opt_present("generate-link-to-definition");
|
||||
|
||||
if generate_link_to_definition && (show_coverage || output_format != OutputFormat::Html) {
|
||||
diag.struct_err(
|
||||
"--generate-link-to-definition option can only be used with HTML output format",
|
||||
)
|
||||
.emit();
|
||||
return Err(1);
|
||||
}
|
||||
|
||||
let (lint_opts, describe_lints, lint_cap) =
|
||||
get_cmd_lint_options(matches, error_format, &debugging_opts);
|
||||
|
||||
|
@ -0,0 +1,6 @@
|
||||
// This test purpose is to check that the "--generate-link-to-definition"
|
||||
// option can only be used on nightly.
|
||||
|
||||
// compile-flags: --generate-link-to-definition
|
||||
|
||||
pub fn f() {}
|
@ -0,0 +1,2 @@
|
||||
error: the `-Z unstable-options` flag must also be passed to enable the flag `generate-link-to-definition`
|
||||
|
6
src/test/rustdoc-ui/generate-link-to-definition-opt.rs
Normal file
6
src/test/rustdoc-ui/generate-link-to-definition-opt.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// This test purpose is to check that the "--generate-link-to-definition"
|
||||
// option can only be used with HTML generation.
|
||||
|
||||
// compile-flags: -Zunstable-options --generate-link-to-definition --output-format json
|
||||
|
||||
pub fn f() {}
|
@ -0,0 +1,2 @@
|
||||
error: --generate-link-to-definition option can only be used with HTML output format
|
||||
|
6
src/test/rustdoc-ui/generate-link-to-definition-opt2.rs
Normal file
6
src/test/rustdoc-ui/generate-link-to-definition-opt2.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// This test purpose is to check that the "--generate-link-to-definition"
|
||||
// option can only be used with HTML generation.
|
||||
|
||||
// compile-flags: -Zunstable-options --generate-link-to-definition --show-coverage
|
||||
|
||||
pub fn f() {}
|
@ -0,0 +1,2 @@
|
||||
error: --generate-link-to-definition option can only be used with HTML output format
|
||||
|
Loading…
Reference in New Issue
Block a user