Skip to content

Commit 4b490ad

Browse files
committed
feat(build-dir): Stabilize build-dir
1 parent f8d9495 commit 4b490ad

File tree

8 files changed

+45
-67
lines changed

8 files changed

+45
-67
lines changed

src/cargo/core/features.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,6 @@ unstable_cli_options!(
844844
avoid_dev_deps: bool = ("Avoid installing dev-dependencies if possible"),
845845
binary_dep_depinfo: bool = ("Track changes to dependency artifacts"),
846846
bindeps: bool = ("Allow Cargo packages to depend on bin, cdylib, and staticlib crates, and use the artifacts built by those crates"),
847-
build_dir: bool = ("Enable the `build.build-dir` option in .cargo/config.toml file"),
848847
#[serde(deserialize_with = "deserialize_comma_separated_list")]
849848
build_std: Option<Vec<String>> = ("Enable Cargo to compile the standard library itself as part of a crate graph compilation"),
850849
#[serde(deserialize_with = "deserialize_comma_separated_list")]
@@ -1360,7 +1359,6 @@ impl CliUnstable {
13601359
"avoid-dev-deps" => self.avoid_dev_deps = parse_empty(k, v)?,
13611360
"binary-dep-depinfo" => self.binary_dep_depinfo = parse_empty(k, v)?,
13621361
"bindeps" => self.bindeps = parse_empty(k, v)?,
1363-
"build-dir" => self.build_dir = parse_empty(k, v)?,
13641362
"build-std" => self.build_std = Some(parse_list(v)),
13651363
"build-std-features" => self.build_std_features = Some(parse_list(v)),
13661364
"cargo-lints" => self.cargo_lints = parse_empty(k, v)?,

src/cargo/core/workspace.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,6 @@ impl<'gctx> Workspace<'gctx> {
443443
}
444444

445445
pub fn build_dir(&self) -> Filesystem {
446-
if !self.gctx().cli_unstable().build_dir {
447-
return self.target_dir();
448-
}
449446
self.build_dir.clone().unwrap_or_else(|| self.target_dir())
450447
}
451448

src/cargo/ops/cargo_clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ pub fn clean(ws: &Workspace<'_>, opts: &CleanOptions<'_>) -> CargoResult<()> {
7878
// Note that we don't bother grabbing a lock here as we're just going to
7979
// blow it all away anyway.
8080
if opts.spec.is_empty() {
81-
let paths: &[PathBuf] = if gctx.cli_unstable().build_dir && build_dir != target_dir {
81+
let paths: &[PathBuf] = if build_dir != target_dir {
8282
&[
8383
target_dir.into_path_unlocked(),
8484
build_dir.into_path_unlocked(),

src/cargo/ops/cargo_output_metadata.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ pub fn output_metadata(ws: &Workspace<'_>, opt: &OutputMetadataOptions) -> Cargo
5252
.collect(),
5353
resolve,
5454
target_directory: ws.target_dir().into_path_unlocked(),
55-
build_directory: ws
56-
.gctx()
57-
.cli_unstable()
58-
.build_dir
59-
.then(|| ws.build_dir().into_path_unlocked()),
55+
build_directory: ws.build_dir().into_path_unlocked(),
6056
version: VERSION,
6157
workspace_root: ws.root().to_path_buf(),
6258
metadata: ws.custom_metadata().cloned(),
@@ -73,8 +69,7 @@ pub struct ExportInfo {
7369
workspace_default_members: Vec<PackageIdSpec>,
7470
resolve: Option<MetadataResolve>,
7571
target_directory: PathBuf,
76-
#[serde(skip_serializing_if = "Option::is_none")]
77-
build_directory: Option<PathBuf>,
72+
build_directory: PathBuf,
7873
version: u32,
7974
workspace_root: PathBuf,
8075
metadata: Option<toml::Value>,

src/cargo/ops/cargo_package/verify.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,7 @@ pub fn run_verify(
6969
// When packaging we use an ephemeral workspace but reuse the build cache to reduce
7070
// verification time if the user has already compiled the dependencies and the fingerprint
7171
// is unchanged.
72-
let target_dir = if gctx.cli_unstable().build_dir {
73-
Some(ws.build_dir())
74-
} else {
75-
Some(ws.target_dir())
76-
};
77-
78-
let mut ws = Workspace::ephemeral(new_pkg, gctx, target_dir, true)?;
72+
let mut ws = Workspace::ephemeral(new_pkg, gctx, Some(ws.build_dir()), true)?;
7973
if let Some(local_reg) = local_reg {
8074
ws.add_local_overlay(
8175
local_reg.upstream,

src/cargo/util/context/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -650,9 +650,6 @@ impl GlobalContext {
650650
///
651651
/// Callers should prefer [`Workspace::build_dir`] instead.
652652
pub fn build_dir(&self, workspace_manifest_path: &PathBuf) -> CargoResult<Option<Filesystem>> {
653-
if !self.cli_unstable().build_dir {
654-
return self.target_dir();
655-
}
656653
if let Some(val) = &self.build_config()?.build_dir {
657654
let replacements = vec![
658655
(

tests/testsuite/cargo/z_help/stdout.term.svg

Lines changed: 41 additions & 43 deletions
Loading

tests/testsuite/cargo_features.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ fn wrong_kind_of_feature() {
206206
Caused by:
207207
unknown Cargo.toml feature `build-dir`
208208
209-
This feature can be enabled via -Zbuild-dir or the `[unstable]` section in config.toml.
210209
See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html for more information.
211210
212211
"#]])

0 commit comments

Comments
 (0)