Skip to content

Commit 5ef33d4

Browse files
authored
Rollup merge of #129050 - GuillaumeGomez:generate-link-to-definition-warning, r=notriddle
Emit a warning instead of an error if `--generate-link-to-definition` is used with other output formats than HTML Fixes rust-lang/docs.rs#2581. It's a bit weird to emit an error in this case anyway, a warning is more than enough. r? ``@notriddle``
2 parents 65054ed + afbab80 commit 5ef33d4

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

src/librustdoc/config.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -733,9 +733,11 @@ impl Options {
733733
let html_no_source = matches.opt_present("html-no-source");
734734

735735
if generate_link_to_definition && (show_coverage || output_format != OutputFormat::Html) {
736-
dcx.fatal(
737-
"--generate-link-to-definition option can only be used with HTML output format",
738-
);
736+
dcx.struct_warn(
737+
"`--generate-link-to-definition` option can only be used with HTML output format",
738+
)
739+
.with_note("`--generate-link-to-definition` option will be ignored")
740+
.emit();
739741
}
740742

741743
let scrape_examples_options = ScrapeExamplesOptions::new(matches, dcx);

tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
// option can only be used with HTML generation.
33

44
//@ compile-flags: -Zunstable-options --generate-link-to-definition --output-format json
5+
//@ check-pass
56

67
pub fn f() {}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
error: --generate-link-to-definition option can only be used with HTML output format
1+
warning: `--generate-link-to-definition` option can only be used with HTML output format
2+
|
3+
= note: `--generate-link-to-definition` option will be ignored
24

tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.rs

-6
This file was deleted.

tests/rustdoc-ui/generate-link-to-definition/generate-link-to-definition-opt2.stderr

-2
This file was deleted.

0 commit comments

Comments
 (0)