Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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: 0 additions & 1 deletion src/cargo/core/compiler/compile_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ impl CompileKind {
.map(|value| {
// This neatly substitutes the manually-specified `host-tuple` target directive
// with the compiling machine's target triple.

if value.as_str() == "host-tuple" {
let host_triple = env!("RUST_HOST_TARGET");
Ok(CompileKind::Target(CompileTarget::new(
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ fn clean_specs(
.collect::<CargoResult<_>>()?;
// A Vec of layouts. This is a little convoluted because there can only be
// one host_layout.
let layouts = if targets.is_empty() {
let layouts = if target_layouts.is_empty() {
vec![(CompileKind::Host, &host_layout)]
} else {
target_layouts
Expand Down
23 changes: 23 additions & 0 deletions tests/testsuite/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -711,6 +711,29 @@ fn package_cleans_all_the_things() {
assert_all_clean(&p.build_dir());
}

#[cargo_test]
fn clean_p_respects_build_target_config() {
let p = project()
.file("Cargo.toml", &basic_manifest("foo", "0.1.0"))
.file("src/lib.rs", "")
.file(
".cargo/config.toml",
&format!("[build]\ntarget = \"{}\"", rustc_host()),
)
.build();

p.cargo("build").run();
p.cargo("clean -p foo --dry-run")
.with_stderr_data(str![[r#"
[SUMMARY] [FILE_NUM] files, [FILE_SIZE]B total
[WARNING] no files deleted due to --dry-run

"#]])
.run();
p.cargo("clean -p foo").run();
assert_all_clean(&p.build_dir().join(rustc_host()));
}

// Ensures that all files for the package have been deleted.
#[track_caller]
fn assert_all_clean(build_dir: &Path) {
Expand Down
Loading