@@ -732,7 +732,7 @@ impl Config {
732732 } )
733733 }
734734
735- fn string_to_path ( & self , value : String , definition : & Definition ) -> PathBuf {
735+ fn string_to_path ( & self , value : & str , definition : & Definition ) -> PathBuf {
736736 let is_path = value. contains ( '/' ) || ( cfg ! ( windows) && value. contains ( '\\' ) ) ;
737737 if is_path {
738738 definition. root ( self ) . join ( value)
@@ -1391,7 +1391,11 @@ impl Config {
13911391
13921392 /// Looks for a path for `tool` in an environment variable or the given config, and returns
13931393 /// `None` if it's not present.
1394- fn maybe_get_tool ( & self , tool : & str , from_config : & Option < PathBuf > ) -> Option < PathBuf > {
1394+ fn maybe_get_tool (
1395+ & self ,
1396+ tool : & str ,
1397+ from_config : & Option < ConfigRelativePath > ,
1398+ ) -> Option < PathBuf > {
13951399 let var = tool. to_uppercase ( ) ;
13961400
13971401 match env:: var_os ( & var) {
@@ -1408,13 +1412,13 @@ impl Config {
14081412 Some ( path)
14091413 }
14101414
1411- None => from_config. clone ( ) ,
1415+ None => from_config. as_ref ( ) . map ( |p| p . resolve_program ( self ) ) ,
14121416 }
14131417 }
14141418
14151419 /// Looks for a path for `tool` in an environment variable or config path, defaulting to `tool`
14161420 /// as a path.
1417- fn get_tool ( & self , tool : & str , from_config : & Option < PathBuf > ) -> PathBuf {
1421+ fn get_tool ( & self , tool : & str , from_config : & Option < ConfigRelativePath > ) -> PathBuf {
14181422 self . maybe_get_tool ( tool, from_config)
14191423 . unwrap_or_else ( || PathBuf :: from ( tool) )
14201424 }
@@ -2084,10 +2088,10 @@ pub struct CargoBuildConfig {
20842088 pub jobs : Option < u32 > ,
20852089 pub rustflags : Option < StringList > ,
20862090 pub rustdocflags : Option < StringList > ,
2087- pub rustc_wrapper : Option < PathBuf > ,
2088- pub rustc_workspace_wrapper : Option < PathBuf > ,
2089- pub rustc : Option < PathBuf > ,
2090- pub rustdoc : Option < PathBuf > ,
2091+ pub rustc_wrapper : Option < ConfigRelativePath > ,
2092+ pub rustc_workspace_wrapper : Option < ConfigRelativePath > ,
2093+ pub rustc : Option < ConfigRelativePath > ,
2094+ pub rustdoc : Option < ConfigRelativePath > ,
20912095 pub out_dir : Option < ConfigRelativePath > ,
20922096}
20932097
0 commit comments