Skip to content

Emit a warning instead of an error if --generate-link-to-definition is used with other output formats than HTML #129050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
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.

Loading