Skip to content

Commit

Permalink
Auto merge of #12908 - weihanglo:profile-merge-trim-paths, r=epage
Browse files Browse the repository at this point in the history
fix: merge `trim-paths` from different profiles
  • Loading branch information
bors committed Nov 2, 2023
2 parents 5613aac + 7535971 commit 6354bb3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3007,6 +3007,10 @@ impl TomlProfile {
if let Some(v) = &profile.strip {
self.strip = Some(v.clone());
}

if let Some(v) = &profile.trim_paths {
self.trim_paths = Some(v.clone())
}
}
}

Expand Down
35 changes: 35 additions & 0 deletions tests/testsuite/profile_trim_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,41 @@ fn multiple_options() {
.run();
}

#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")]
fn profile_merge_works() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
[profile.dev]
trim-paths = ["macro"]
[profile.custom]
inherits = "dev"
trim-paths = ["diagnostics"]
"#,
)
.file("src/lib.rs", "")
.build();

p.cargo("build -v -Ztrim-paths --profile custom")
.masquerade_as_nightly_cargo(&["-Ztrim-paths"])
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([CWD])
[RUNNING] `rustc [..]\
-Zremap-path-scope=diagnostics \
--remap-path-prefix=[..]/lib/rustlib/src/rust=/rustc/[..] \
--remap-path-prefix=[CWD]= [..]
[FINISHED] custom [..]",
)
.run();
}

#[cargo_test(nightly, reason = "-Zremap-path-scope is unstable")]
fn registry_dependency() {
Package::new("bar", "0.0.1")
Expand Down

0 comments on commit 6354bb3

Please sign in to comment.