Skip to content

Commit f65c6af

Browse files
authored
Rollup merge of #136467 - onur-ozkan:override-default-profile-on-tarballs, r=jieyouxu
override default config profile on tarballs This is the same logic used in the Python script https://github.com/rust-lang/rust/blob/613bdd49978298648ed05ace086bd1ecad54b44a/src/bootstrap/bootstrap.py#L1273-L1274
2 parents 5bd0f32 + 8c5e6a2 commit f65c6af

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/bootstrap/src/core/config/config.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ trait Merge {
700700
impl Merge for TomlConfig {
701701
fn merge(
702702
&mut self,
703-
TomlConfig { build, install, llvm, rust, dist, target, profile: _, change_id }: Self,
703+
TomlConfig { build, install, llvm, rust, dist, target, profile, change_id }: Self,
704704
replace: ReplaceOpt,
705705
) {
706706
fn do_merge<T: Merge>(x: &mut Option<T>, y: Option<T>, replace: ReplaceOpt) {
@@ -712,7 +712,10 @@ impl Merge for TomlConfig {
712712
}
713713
}
714714
}
715+
715716
self.change_id.inner.merge(change_id.inner, replace);
717+
self.profile.merge(profile, replace);
718+
716719
do_merge(&mut self.build, build, replace);
717720
do_merge(&mut self.install, install, replace);
718721
do_merge(&mut self.llvm, llvm, replace);
@@ -1505,6 +1508,10 @@ impl Config {
15051508
build.cargo = build.cargo.take().or(std::env::var_os("CARGO").map(|p| p.into()));
15061509
}
15071510

1511+
if GitInfo::new(false, &config.src).is_from_tarball() && toml.profile.is_none() {
1512+
toml.profile = Some("dist".into());
1513+
}
1514+
15081515
if let Some(include) = &toml.profile {
15091516
// Allows creating alias for profile names, allowing
15101517
// profiles to be renamed while maintaining back compatibility

0 commit comments

Comments
 (0)