about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2022-01-01 17:03:24 +0100
committerbjorn3 <bjorn3@users.noreply.github.com>2022-01-01 17:03:24 +0100
commitad6f98cd28e02d10323c125c8ad2eef44dbfbb20 (patch)
tree5fcc7047ed867e2d22e397c0eee30a8c8e61cdc4 /src/bootstrap
parent947e9483e9684025faee9eaba56a0fbb200d26b8 (diff)
downloadrust-ad6f98cd28e02d10323c125c8ad2eef44dbfbb20.tar.gz
rust-ad6f98cd28e02d10323c125c8ad2eef44dbfbb20.zip
Remove the merge dependency
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/Cargo.toml1
-rw-r--r--src/bootstrap/config.rs11
2 files changed, 9 insertions, 3 deletions
diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml
index 1f218dd8d67..b68b2163f87 100644
--- a/src/bootstrap/Cargo.toml
+++ b/src/bootstrap/Cargo.toml
@@ -47,7 +47,6 @@ toml = "0.5"
 time = "0.1"
 ignore = "0.4.10"
 opener = "0.5"
-merge = { version = "0.1.0", default-features = false, features = ["std"] }
 once_cell = "1.7.2"
 
 [target.'cfg(windows)'.dependencies.winapi]
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index fcca783fbfe..c930657c5bd 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -18,7 +18,6 @@ pub use crate::flags::Subcommand;
 use crate::flags::{Color, Flags};
 use crate::util::exe;
 use build_helper::t;
-use merge::Merge;
 use serde::Deserialize;
 
 macro_rules! check_ci_llvm {
@@ -334,6 +333,10 @@ struct TomlConfig {
     profile: Option<String>,
 }
 
+trait Merge {
+    fn merge(&mut self, other: Self);
+}
+
 impl Merge for TomlConfig {
     fn merge(
         &mut self,
@@ -357,6 +360,8 @@ impl Merge for TomlConfig {
     }
 }
 
+// We are using a decl macro instead of a derive proc macro here to reduce the compile time of
+// rustbuild.
 macro_rules! derive_merge {
     ($(#[$attr:meta])* struct $name:ident {
         $($field:ident: $field_ty:ty,)*
@@ -369,7 +374,9 @@ macro_rules! derive_merge {
         impl Merge for $name {
             fn merge(&mut self, other: Self) {
                 $(
-                    Merge::merge(&mut self.$field, other.$field);
+                    if !self.$field.is_some() {
+                        self.$field = other.$field;
+                    }
                 )*
             }
         }