Skip to content

Commit

Permalink
Rollup merge of #129050 - GuillaumeGomez:generate-link-to-definition-…
Browse files Browse the repository at this point in the history
…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`
  • Loading branch information
GuillaumeGomez committed Aug 13, 2024
2 parents fb6cf56 + afbab80 commit d3a37ef
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
8 changes: 5 additions & 3 deletions src/librustdoc/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,11 @@ impl Options {
let html_no_source = matches.opt_present("html-no-source");

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

let scrape_examples_options = ScrapeExamplesOptions::new(matches, dcx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
// option can only be used with HTML generation.

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

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

This file was deleted.

This file was deleted.

0 comments on commit d3a37ef

Please sign in to comment.