@@ -127,6 +127,7 @@ use std::str::FromStr;
127127use anyhow:: { Error , bail} ;
128128use cargo_util:: ProcessBuilder ;
129129use serde:: { Deserialize , Serialize } ;
130+ use tracing:: debug;
130131
131132use crate :: GlobalContext ;
132133use crate :: core:: resolver:: ResolveBehavior ;
@@ -861,6 +862,7 @@ unstable_cli_options!(
861862 dual_proc_macros: bool = ( "Build proc-macros for both the host and the target" ) ,
862863 feature_unification: bool = ( "Enable new feature unification modes in workspaces" ) ,
863864 features: Option <Vec <String >>,
865+ fine_grain_locking: bool = ( "Use fine grain locking instead of locking the entire build cache" ) ,
864866 fix_edition: Option <FixEdition > = ( "Permanently unstable edition migration helper" ) ,
865867 gc: bool = ( "Track cache usage and \" garbage collect\" unused files" ) ,
866868 #[ serde( deserialize_with = "deserialize_git_features" ) ]
@@ -1242,6 +1244,9 @@ impl CliUnstable {
12421244 if self . gitoxide . is_none ( ) && cargo_use_gitoxide_instead_of_git2 ( ) {
12431245 self . gitoxide = GitoxideFeatures :: safe ( ) . into ( ) ;
12441246 }
1247+
1248+ self . implicitly_enable_features_if_needed ( ) ;
1249+
12451250 Ok ( warnings)
12461251 }
12471252
@@ -1380,6 +1385,7 @@ impl CliUnstable {
13801385 "direct-minimal-versions" => self . direct_minimal_versions = parse_empty ( k, v) ?,
13811386 "dual-proc-macros" => self . dual_proc_macros = parse_empty ( k, v) ?,
13821387 "feature-unification" => self . feature_unification = parse_empty ( k, v) ?,
1388+ "fine-grain-locking" => self . fine_grain_locking = parse_empty ( k, v) ?,
13831389 "fix-edition" => {
13841390 let fe = v
13851391 . ok_or_else ( || anyhow:: anyhow!( "-Zfix-edition expected a value" ) ) ?
@@ -1512,6 +1518,13 @@ impl CliUnstable {
15121518 ) ;
15131519 }
15141520 }
1521+
1522+ fn implicitly_enable_features_if_needed ( & mut self ) {
1523+ if self . fine_grain_locking && !self . build_dir_new_layout {
1524+ debug ! ( "-Zbuild-dir-new-layout implicitly enabled by -Zfine-grain-locking" ) ;
1525+ self . build_dir_new_layout = true ;
1526+ }
1527+ }
15151528}
15161529
15171530/// Returns the current release channel ("stable", "beta", "nightly", "dev").
0 commit comments