Skip to content

Commit

Permalink
move --force-rebuild behind unstable flag
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshMcguigan committed Feb 20, 2019
1 parent 115f392 commit d60af7c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,13 @@ pub trait ArgMatchesExt {
let mut build_config = BuildConfig::new(config, self.jobs()?, &self.target(), mode)?;
build_config.message_format = message_format;
build_config.release = self._is_present("release");
build_config.build_plan = self._is_present("build-plan");
build_config.force_rebuild = self._is_present("force-rebuild");
if build_config.force_rebuild && !config.cli_unstable().unstable_options {
Err(failure::format_err!(
"`--force-rebuild` flag is unstable, pass `-Z unstable-options` to enable it"
))?;
};
build_config.build_plan = self._is_present("build-plan");
if build_config.build_plan && !config.cli_unstable().unstable_options {
Err(failure::format_err!(
"`--build-plan` flag is unstable, pass `-Z unstable-options` to enable it"
Expand Down
8 changes: 7 additions & 1 deletion tests/testsuite/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,13 @@ fn force_rebuild_displays_error() {
.with_stderr_contains("[..]warning: unused import[..]")
.run();

foo.cargo("check --force-rebuild")
// for now this requires the unstable feature flag, so expect an error here
let output = foo.cargo("check --force-rebuild")
.exec_with_output();
assert!(output.is_err());

foo.cargo("check -Z unstable-options --force-rebuild")
.masquerade_as_nightly_cargo() // remove this when `-Z unstable-options` is no longer required
.with_stderr_contains("[..]warning: unused import[..]")
.run();
}
Expand Down

0 comments on commit d60af7c

Please sign in to comment.