@@ -97,7 +97,7 @@ pub fn docs(build: &Build, stage: u32, host: &str) {
97
97
}
98
98
99
99
fn find_files ( files : & [ & str ] , path : & [ PathBuf ] ) -> Vec < PathBuf > {
100
- let mut found = Vec :: new ( ) ;
100
+ let mut found = Vec :: with_capacity ( files . len ( ) ) ;
101
101
102
102
for file in files {
103
103
let file_path =
@@ -119,17 +119,9 @@ fn make_win_dist(rust_root: &Path, plat_root: &Path, target_triple: &str, build:
119
119
//Ask gcc where it keeps its stuff
120
120
let mut cmd = Command :: new ( build. cc ( target_triple) ) ;
121
121
cmd. arg ( "-print-search-dirs" ) ;
122
- build. run_quiet ( & mut cmd) ;
123
- let gcc_out =
124
- String :: from_utf8 (
125
- cmd
126
- . output ( )
127
- . expect ( "failed to execute gcc" )
128
- . stdout ) . expect ( "gcc.exe output was not utf8" ) ;
129
-
130
- let mut bin_path: Vec < _ > =
131
- env:: split_paths ( & env:: var_os ( "PATH" ) . unwrap_or_default ( ) )
132
- . collect ( ) ;
122
+ let gcc_out = output ( & mut cmd) ;
123
+
124
+ let mut bin_path: Vec < _ > = env:: split_paths ( & env:: var_os ( "PATH" ) . unwrap_or_default ( ) ) . collect ( ) ;
133
125
let mut lib_path = Vec :: new ( ) ;
134
126
135
127
for line in gcc_out. lines ( ) {
@@ -140,7 +132,7 @@ fn make_win_dist(rust_root: &Path, plat_root: &Path, target_triple: &str, build:
140
132
line[ ( idx + 1 ) ..]
141
133
. trim_left_matches ( trim_chars)
142
134
. split ( ';' )
143
- . map ( |s| PathBuf :: from ( s ) ) ;
135
+ . map ( PathBuf :: from) ;
144
136
145
137
if key == "programs" {
146
138
bin_path. extend ( value) ;
@@ -149,15 +141,15 @@ fn make_win_dist(rust_root: &Path, plat_root: &Path, target_triple: &str, build:
149
141
}
150
142
}
151
143
152
- let target_tools = vec ! [ "gcc.exe" , "ld.exe" , "ar.exe" , "dlltool.exe" , "libwinpthread-1.dll" ] ;
144
+ let target_tools = [ "gcc.exe" , "ld.exe" , "ar.exe" , "dlltool.exe" , "libwinpthread-1.dll" ] ;
153
145
let mut rustc_dlls = vec ! [ "libstdc++-6.dll" , "libwinpthread-1.dll" ] ;
154
146
if target_triple. starts_with ( "i686-" ) {
155
147
rustc_dlls. push ( "libgcc_s_dw2-1.dll" ) ;
156
148
} else {
157
149
rustc_dlls. push ( "libgcc_s_seh-1.dll" ) ;
158
150
}
159
151
160
- let target_libs = vec ! [ //MinGW libs
152
+ let target_libs = [ //MinGW libs
161
153
"libgcc.a" ,
162
154
"libgcc_eh.a" ,
163
155
"libgcc_s.a" ,
@@ -203,7 +195,7 @@ fn make_win_dist(rust_root: &Path, plat_root: &Path, target_triple: &str, build:
203
195
let target_libs = find_files ( & target_libs, & lib_path) ;
204
196
205
197
fn copy_to_folder ( src : & Path , dest_folder : & Path ) {
206
- let file_name = src. file_name ( ) . unwrap ( ) . to_os_string ( ) ;
198
+ let file_name = src. file_name ( ) . unwrap ( ) ;
207
199
let dest = dest_folder. join ( file_name) ;
208
200
copy ( src, & dest) ;
209
201
}
@@ -234,8 +226,6 @@ fn make_win_dist(rust_root: &Path, plat_root: &Path, target_triple: &str, build:
234
226
///
235
227
/// This contains all the bits and pieces to run the MinGW Windows targets
236
228
/// without any extra installed software (e.g. we bundle gcc, libraries, etc).
237
- /// Currently just shells out to a python script, but that should be rewritten
238
- /// in Rust.
239
229
pub fn mingw ( build : & Build , host : & str ) {
240
230
println ! ( "Dist mingw ({})" , host) ;
241
231
let name = pkgname ( build, "rust-mingw" ) ;
@@ -366,9 +356,9 @@ pub fn rustc(build: &Build, stage: u32, host: &str) {
366
356
pub fn debugger_scripts ( build : & Build ,
367
357
sysroot : & Path ,
368
358
host : & str ) {
359
+ let dst = sysroot. join ( "lib/rustlib/etc" ) ;
360
+ t ! ( fs:: create_dir_all( & dst) ) ;
369
361
let cp_debugger_script = |file : & str | {
370
- let dst = sysroot. join ( "lib/rustlib/etc" ) ;
371
- t ! ( fs:: create_dir_all( & dst) ) ;
372
362
install ( & build. src . join ( "src/etc/" ) . join ( file) , & dst, 0o644 ) ;
373
363
} ;
374
364
if host. contains ( "windows-msvc" ) {
@@ -595,7 +585,7 @@ pub fn rust_src(build: &Build) {
595
585
t ! ( fs:: remove_dir_all( & image) ) ;
596
586
}
597
587
598
- const CARGO_VENDOR_VERSION : & ' static str = "0.1.4" ;
588
+ const CARGO_VENDOR_VERSION : & str = "0.1.4" ;
599
589
600
590
/// Creates the plain source tarball
601
591
pub fn plain_source_tarball ( build : & Build ) {
0 commit comments