Skip to content
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

set -Zmtime_on_use from config or ENV #7411

Merged
merged 3 commits into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions src/cargo/core/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ impl CliUnstable {
"advanced-env" => self.advanced_env = true,
"config-profile" => self.config_profile = true,
"dual-proc-macros" => self.dual_proc_macros = true,
// can also be set in .cargo/config or with and ENV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the unstable documentation be updated as well?

"mtime-on-use" => self.mtime_on_use = true,
"install-upgrade" => self.install_upgrade = true,
"cache-messages" => self.cache_messages = true,
Expand Down
8 changes: 7 additions & 1 deletion src/cargo/util/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use url::Url;
use self::ConfigValue as CV;
use crate::core::profiles::ConfigProfiles;
use crate::core::shell::Verbosity;
use crate::core::{CliUnstable, Shell, SourceId, Workspace};
use crate::core::{nightly_features_allowed, CliUnstable, Shell, SourceId, Workspace};
use crate::ops;
use crate::util::errors::{self, internal, CargoResult, CargoResultExt};
use crate::util::toml as cargo_toml;
Expand Down Expand Up @@ -626,6 +626,12 @@ impl Config {
self.target_dir = cli_target_dir;
self.cli_flags.parse(unstable_flags)?;

if nightly_features_allowed() {
if let Some(val) = self.get_bool("unstable.mtime_on_use")?.map(|t| t.val) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this try using the newer .get::<Option<bool>> API as well?

self.cli_flags.mtime_on_use |= val;
}
}

Ok(())
}

Expand Down