Skip to content

Commit

Permalink
Rollup merge of rust-lang#44138 - steveklabnik:rustdoc-deprecations, …
Browse files Browse the repository at this point in the history
…r=Manishearth

Deprecate several flags in rustdoc

Part of rust-lang#44136

cc @rust-lang/dev-tools @rust-lang/docs

This is a very basic PR to start deprecating some flags; `rustdoc` doesn't really have fancy output options like `rustc` does, so I went with `eprintln!`. Happy to change it if people feel that's not appropriate.

Also, I have no idea if we can or should write tests here, so I didn't try. If someone feels strongly about it, then let's do it, but given that the only outcome here is a side effect...
  • Loading branch information
frewsxcv authored Aug 29, 2017
2 parents efa27ac + 4cd5314 commit 44e03a4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/librustdoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ pub fn main_args(args: &[String]) -> isize {
// Check for unstable options.
nightly_options::check_nightly_options(&matches, &opts());

// check for deprecated options
check_deprecated_options(&matches);

if matches.opt_present("h") || matches.opt_present("help") {
usage("rustdoc");
return 0;
Expand Down Expand Up @@ -538,3 +541,16 @@ where R: 'static + Send, F: 'static + Send + FnOnce(Output) -> R {
});
rx.recv().unwrap()
}

/// Prints deprecation warnings for deprecated options
fn check_deprecated_options(matches: &getopts::Matches) {
if matches.opt_present("input-format") ||
matches.opt_present("output-format") ||
matches.opt_present("plugin-path") ||
matches.opt_present("plugins") ||
matches.opt_present("no-defaults") ||
matches.opt_present("passes") {
eprintln!("WARNING: this flag is considered deprecated");
eprintln!("WARNING: please see https://github.com/rust-lang/rust/issues/44136");
}
}

0 comments on commit 44e03a4

Please sign in to comment.