Created
September 5, 2017 21:56
-
-
Save alexcrichton/59b382d3a7410737ec1107710a0acc60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/cargo/ops/cargo_rustc/custom_build.rs b/src/cargo/ops/cargo_rustc/custom_build.rs | |
index 727f0d3..d2c34b9 100644 | |
--- a/src/cargo/ops/cargo_rustc/custom_build.rs | |
+++ b/src/cargo/ops/cargo_rustc/custom_build.rs | |
@@ -316,15 +316,10 @@ impl BuildState { | |
} | |
fn has_override(&self, unit: &Unit) -> bool { | |
- let key = unit.pkg.manifest().links().map(|l| (l.to_string(), unit.kind)); | |
- match key.and_then(|k| self.overrides.get(&k)) { | |
- Some(output) => { | |
- self.insert(unit.pkg.package_id().clone(), unit.kind, | |
- output.clone()); | |
- true | |
- } | |
- None => false, | |
- } | |
+ self.outputs | |
+ .lock() | |
+ .unwrap() | |
+ .contains_key(&(unit.pkg.package_id().clone(), unit.kind)) | |
} | |
} | |
@@ -483,7 +478,7 @@ pub fn build_map<'b, 'cfg>(cx: &mut Context<'b, 'cfg>, | |
// Recursive function to build up the map we're constructing. This function | |
// memoizes all of its return values as it goes along. | |
fn build<'a, 'b, 'cfg>(out: &'a mut HashMap<Unit<'b>, BuildScripts>, | |
- cx: &Context<'b, 'cfg>, | |
+ cx: &mut Context<'b, 'cfg>, | |
unit: &Unit<'b>) | |
-> CargoResult<&'a BuildScripts> { | |
// Do a quick pre-flight check to see if we've already calculated the | |
@@ -492,6 +487,15 @@ pub fn build_map<'b, 'cfg>(cx: &mut Context<'b, 'cfg>, | |
return Ok(&out[unit]) | |
} | |
+ let key = unit.pkg.manifest().links().map(|l| (l.to_string(), unit.kind)); | |
+ if let Some(output) = key.and_then(|k| cx.build_state.overrides.get(&k)) { | |
+ cx.build_state | |
+ .outputs | |
+ .lock() | |
+ .unwrap() | |
+ .insert((unit.pkg.package_id().clone(), unit.kind), output.clone()); | |
+ } | |
+ | |
let mut ret = BuildScripts::default(); | |
if !unit.target.is_custom_build() && unit.pkg.has_custom_build() { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment