@@ -393,9 +393,9 @@ mod sources {
393
393
mod c_vendor {
394
394
extern crate cc;
395
395
396
+ use sources;
396
397
use std:: env;
397
398
use std:: path:: PathBuf ;
398
- use sources;
399
399
400
400
/// Compile intrinsics from the compiler-rt C source code
401
401
pub fn compile ( llvm_target : & [ & str ] ) {
@@ -464,9 +464,9 @@ mod c_system {
464
464
use std:: collections:: HashMap ;
465
465
use std:: env;
466
466
use std:: fs:: File ;
467
+ use std:: path:: { Path , PathBuf } ;
467
468
use std:: process:: { Command , Output } ;
468
469
use std:: str;
469
- use std:: path:: { Path , PathBuf } ;
470
470
471
471
use sources;
472
472
@@ -492,24 +492,28 @@ mod c_system {
492
492
let target_arch = env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) ;
493
493
let target_os = env:: var ( "CARGO_CFG_TARGET_OS" ) . unwrap ( ) ;
494
494
let r = match target_arch. as_str ( ) {
495
- "arm" => if target. ends_with ( "eabihf" ) && target_os != "windows" {
496
- "armhf"
497
- } else {
498
- "arm"
499
- } ,
500
- "x86" => if target_os == "android" {
501
- "i686"
502
- } else {
503
- "i386"
504
- } ,
495
+ "arm" => {
496
+ if target. ends_with ( "eabihf" ) && target_os != "windows" {
497
+ "armhf"
498
+ } else {
499
+ "arm"
500
+ }
501
+ }
502
+ "x86" => {
503
+ if target_os == "android" {
504
+ "i686"
505
+ } else {
506
+ "i386"
507
+ }
508
+ }
505
509
_ => target_arch. as_str ( ) ,
506
510
} ;
507
511
r. to_string ( )
508
512
}
509
513
510
514
fn find_library < I > ( dirs : I , libname : & str ) -> Result < PathBuf , Vec < String > >
511
515
where
512
- I : Iterator < Item = PathBuf >
516
+ I : Iterator < Item = PathBuf > ,
513
517
{
514
518
let mut paths = Vec :: new ( ) ;
515
519
for dir in dirs {
@@ -530,7 +534,11 @@ mod c_system {
530
534
let compiler_rt_arch = get_arch_name_for_compiler_rtlib ( ) ;
531
535
let out_dir = env:: var ( "OUT_DIR" ) . unwrap ( ) ;
532
536
533
- if ALL_SUPPORTED_ARCHES . split ( ";" ) . find ( |x| * x == compiler_rt_arch) == None {
537
+ if ALL_SUPPORTED_ARCHES
538
+ . split ( ";" )
539
+ . find ( |x| * x == compiler_rt_arch)
540
+ == None
541
+ {
534
542
return ;
535
543
}
536
544
@@ -559,12 +567,15 @@ mod c_system {
559
567
Command :: new ( llvm_config) . arg ( "--libdir" ) ,
560
568
) ;
561
569
let libdir = str:: from_utf8 ( & output. stdout ) . unwrap ( ) . trim_end ( ) ;
562
- let paths = std:: fs:: read_dir ( Path :: new ( libdir) . join ( "clang" ) ) . unwrap ( ) . map ( |e| {
563
- e . unwrap ( ) . path ( ) . join ( "lib" ) . join ( subpath )
564
- } ) ;
570
+ let paths = std:: fs:: read_dir ( Path :: new ( libdir) . join ( "clang" ) )
571
+ . unwrap ( )
572
+ . map ( |e| e . unwrap ( ) . path ( ) . join ( "lib" ) . join ( subpath ) ) ;
565
573
match find_library ( paths, & libname) {
566
574
Ok ( p) => p,
567
- Err ( paths) => panic ! ( "failed to find llvm-config's compiler-rt: {}" , paths. join( ":" ) ) ,
575
+ Err ( paths) => panic ! (
576
+ "failed to find llvm-config's compiler-rt: {}" ,
577
+ paths. join( ":" )
578
+ ) ,
568
579
}
569
580
} else {
570
581
panic ! ( "neither CLANG nor LLVM_CONFIG could be read" ) ;
@@ -581,10 +592,15 @@ mod c_system {
581
592
}
582
593
583
594
let sources = sources:: get_sources ( llvm_target) ;
584
- let mut new = ar:: Builder :: new ( File :: create ( Path :: new ( & out_dir) . join ( "libcompiler-rt.a" ) ) . unwrap ( ) ) ;
595
+ let mut new =
596
+ ar:: Builder :: new ( File :: create ( Path :: new ( & out_dir) . join ( "libcompiler-rt.a" ) ) . unwrap ( ) ) ;
585
597
for ( sym, _src) in sources. map . iter ( ) {
586
598
let & i = {
587
- let sym_ = if sym. starts_with ( "__" ) { & sym[ 2 ..] } else { & sym } ;
599
+ let sym_ = if sym. starts_with ( "__" ) {
600
+ & sym[ 2 ..]
601
+ } else {
602
+ & sym
603
+ } ;
588
604
match files. get ( & format ! ( "{}.c.o" , sym_) ) {
589
605
Some ( i) => i,
590
606
None => match files. get ( & format ! ( "{}.S.o" , sym_) ) {
0 commit comments