@@ -4,6 +4,7 @@ use std::hash::{Hash, Hasher};
4
4
use std:: path:: PathBuf ;
5
5
use std:: process:: Command ;
6
6
use std:: io:: { self , Write } ;
7
+ use std:: fs;
7
8
8
9
use rustc_version:: VersionMeta ;
9
10
use tempdir:: TempDir ;
@@ -34,6 +35,7 @@ fn build(
34
35
ctoml : & cargo:: Toml ,
35
36
home : & Home ,
36
37
rustflags : & Rustflags ,
38
+ src : & Src ,
37
39
hash : u64 ,
38
40
verbose : bool ,
39
41
) -> Result < ( ) > {
@@ -66,6 +68,15 @@ version = "0.0.0"
66
68
stoml. push_str ( & profile. to_string ( ) )
67
69
}
68
70
71
+ {
72
+ // Recent rust-src comes with a lockfile for libstd. Use it.
73
+ let lockfile = src. path ( ) . join ( "Cargo.lock" ) ;
74
+ if lockfile. exists ( ) {
75
+ fs:: copy ( lockfile, & td. join ( "Cargo.lock" ) ) . chain_err (
76
+ || "couldn't copy lock file" ,
77
+ ) ?;
78
+ }
79
+ }
69
80
util:: write ( & td. join ( "Cargo.toml" ) , & stoml) ?;
70
81
util:: mkdir ( & td. join ( "src" ) ) ?;
71
82
util:: write ( & td. join ( "src/lib.rs" ) , "" ) ?;
@@ -187,7 +198,7 @@ pub fn update(
187
198
let hash = hash ( cmode, & blueprint, rustflags, & ctoml, meta) ?;
188
199
189
200
if old_hash ( cmode, home) ? != Some ( hash) {
190
- build ( cmode, blueprint, & ctoml, home, rustflags, hash, verbose) ?;
201
+ build ( cmode, blueprint, & ctoml, home, rustflags, src , hash, verbose) ?;
191
202
}
192
203
193
204
// copy host artifacts into the sysroot, if necessary
0 commit comments