@@ -16,6 +16,8 @@ use crate::{
1616 Error , ErrorKind , OutputKind ,
1717} ;
1818
19+ pub ( crate ) type CompilerFamilyLookupCache = HashMap < Box < Path > , ToolFamily > ;
20+
1921/// Configuration used to represent an invocation of a C compiler.
2022///
2123/// This can be used to figure out what compiler is in use, what the arguments
@@ -40,7 +42,7 @@ pub struct Tool {
4042impl Tool {
4143 pub ( crate ) fn new (
4244 path : PathBuf ,
43- cached_compiler_family : & RwLock < HashMap < Box < Path > , ToolFamily > > ,
45+ cached_compiler_family : & RwLock < CompilerFamilyLookupCache > ,
4446 cargo_output : & CargoOutput ,
4547 out_dir : Option < & Path > ,
4648 ) -> Self {
@@ -57,7 +59,7 @@ impl Tool {
5759 pub ( crate ) fn with_args (
5860 path : PathBuf ,
5961 args : Vec < String > ,
60- cached_compiler_family : & RwLock < HashMap < Box < Path > , ToolFamily > > ,
62+ cached_compiler_family : & RwLock < CompilerFamilyLookupCache > ,
6163 cargo_output : & CargoOutput ,
6264 out_dir : Option < & Path > ,
6365 ) -> Self {
@@ -90,7 +92,7 @@ impl Tool {
9092 path : PathBuf ,
9193 args : Vec < String > ,
9294 cuda : bool ,
93- cached_compiler_family : & RwLock < HashMap < Box < Path > , ToolFamily > > ,
95+ cached_compiler_family : & RwLock < CompilerFamilyLookupCache > ,
9496 cargo_output : & CargoOutput ,
9597 out_dir : Option < & Path > ,
9698 ) -> Self {
@@ -238,7 +240,7 @@ impl Tool {
238240 Some ( fname) if fname. contains ( "clang" ) => {
239241 let is_clang_cl = args
240242 . iter ( )
241- . find_map ( |a| a. strip_prefix ( "--driver-mode=" ) == Some ( "cl" ) )
243+ . any ( |a| a. strip_prefix ( "--driver-mode=" ) == Some ( "cl" ) ) ;
242244 if is_clang_cl {
243245 ToolFamily :: Msvc { clang_cl : true }
244246 } else {
0 commit comments