@@ -689,48 +689,41 @@ fn supported_sanitizers(
689689 target : Interned < String > ,
690690 channel : & str ,
691691) -> Vec < SanitizerRuntime > {
692- let mut result = Vec :: new ( ) ;
692+ let darwin_libs = |os : & str , components : & [ & str ] | -> Vec < SanitizerRuntime > {
693+ components
694+ . into_iter ( )
695+ . map ( move |c| SanitizerRuntime {
696+ cmake_target : format ! ( "clang_rt.{}_{}_dynamic" , c, os) ,
697+ path : out_dir
698+ . join ( & format ! ( "build/lib/darwin/libclang_rt.{}_{}_dynamic.dylib" , c, os) ) ,
699+ name : format ! ( "librustc-{}_rt.{}.dylib" , channel, c) ,
700+ } )
701+ . collect ( )
702+ } ;
703+
704+ let common_libs = |os : & str , arch : & str , components : & [ & str ] | -> Vec < SanitizerRuntime > {
705+ components
706+ . into_iter ( )
707+ . map ( move |c| SanitizerRuntime {
708+ cmake_target : format ! ( "clang_rt.{}-{}" , c, arch) ,
709+ path : out_dir. join ( & format ! ( "build/lib/{}/libclang_rt.{}-{}.a" , os, c, arch) ) ,
710+ name : format ! ( "librustc-{}_rt.{}.a" , channel, c) ,
711+ } )
712+ . collect ( )
713+ } ;
714+
693715 match & * target {
694- "x86_64-apple-darwin" => {
695- for s in & [ "asan" , "lsan" , "tsan" ] {
696- result. push ( SanitizerRuntime {
697- cmake_target : format ! ( "clang_rt.{}_osx_dynamic" , s) ,
698- path : out_dir
699- . join ( & format ! ( "build/lib/darwin/libclang_rt.{}_osx_dynamic.dylib" , s) ) ,
700- name : format ! ( "librustc-{}_rt.{}.dylib" , channel, s) ,
701- } ) ;
702- }
716+ "aarch64-fuchsia" => common_libs ( "fuchsia" , "aarch64" , & [ "asan" ] ) ,
717+ "aarch64-unknown-linux-gnu" => {
718+ common_libs ( "linux" , "aarch64" , & [ "asan" , "lsan" , "msan" , "tsan" ] )
703719 }
720+ "x86_64-apple-darwin" => darwin_libs ( "osx" , & [ "asan" , "lsan" , "tsan" ] ) ,
721+ "x86_64-fuchsia" => common_libs ( "fuchsia" , "x86_64" , & [ "asan" ] ) ,
704722 "x86_64-unknown-linux-gnu" => {
705- for s in & [ "asan" , "lsan" , "msan" , "tsan" ] {
706- result. push ( SanitizerRuntime {
707- cmake_target : format ! ( "clang_rt.{}-x86_64" , s) ,
708- path : out_dir. join ( & format ! ( "build/lib/linux/libclang_rt.{}-x86_64.a" , s) ) ,
709- name : format ! ( "librustc-{}_rt.{}.a" , channel, s) ,
710- } ) ;
711- }
712- }
713- "x86_64-fuchsia" => {
714- for s in & [ "asan" ] {
715- result. push ( SanitizerRuntime {
716- cmake_target : format ! ( "clang_rt.{}-x86_64" , s) ,
717- path : out_dir. join ( & format ! ( "build/lib/fuchsia/libclang_rt.{}-x86_64.a" , s) ) ,
718- name : format ! ( "librustc-{}_rt.{}.a" , channel, s) ,
719- } ) ;
720- }
721- }
722- "aarch64-fuchsia" => {
723- for s in & [ "asan" ] {
724- result. push ( SanitizerRuntime {
725- cmake_target : format ! ( "clang_rt.{}-aarch64" , s) ,
726- path : out_dir. join ( & format ! ( "build/lib/fuchsia/libclang_rt.{}-aarch64.a" , s) ) ,
727- name : format ! ( "librustc-{}_rt.{}.a" , channel, s) ,
728- } ) ;
729- }
723+ common_libs ( "linux" , "x86_64" , & [ "asan" , "lsan" , "msan" , "tsan" ] )
730724 }
731- _ => { }
725+ _ => Vec :: new ( ) ,
732726 }
733- result
734727}
735728
736729struct HashStamp {
0 commit comments