Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove the merge dependency
  • Loading branch information
bjorn3 committed Jan 1, 2022
1 parent 947e948 commit ad6f98c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 0 additions & 7 deletions Cargo.lock
Expand Up @@ -176,7 +176,6 @@ dependencies = [
"getopts",
"ignore",
"libc",
"merge",
"num_cpus",
"once_cell",
"opener",
Expand Down Expand Up @@ -2220,12 +2219,6 @@ dependencies = [
"autocfg",
]

[[package]]
name = "merge"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10bbef93abb1da61525bbc45eeaff6473a41907d19f8f9aa5168d214e10693e9"

[[package]]
name = "minifier"
version = "0.0.41"
Expand Down
1 change: 0 additions & 1 deletion src/bootstrap/Cargo.toml
Expand Up @@ -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]
Expand Down
11 changes: 9 additions & 2 deletions src/bootstrap/config.rs
Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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,)*
Expand All @@ -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;
}
)*
}
}
Expand Down

0 comments on commit ad6f98c

Please sign in to comment.