@@ -44,8 +44,9 @@ use crate::config::{
44
44
InstrumentCoverage , OptLevel , OutFileName , OutputType , RemapPathScopeComponents ,
45
45
SwitchWithOptPath ,
46
46
} ;
47
+ use crate :: filesearch:: FileSearch ;
47
48
use crate :: parse:: { ParseSess , add_feature_diagnostics} ;
48
- use crate :: search_paths:: { PathKind , SearchPath } ;
49
+ use crate :: search_paths:: SearchPath ;
49
50
use crate :: { errors, filesearch, lint} ;
50
51
51
52
struct OptimizationFuel {
@@ -218,6 +219,9 @@ pub struct Session {
218
219
/// This is mainly useful for other tools that reads that debuginfo to figure out
219
220
/// how to call the compiler with the same arguments.
220
221
pub expanded_args : Vec < String > ,
222
+
223
+ target_filesearch : FileSearch ,
224
+ host_filesearch : FileSearch ,
221
225
}
222
226
223
227
#[ derive( PartialEq , Eq , PartialOrd , Ord ) ]
@@ -443,11 +447,11 @@ impl Session {
443
447
format ! ( "__rustc_proc_macro_decls_{:08x}__" , stable_crate_id. as_u64( ) )
444
448
}
445
449
446
- pub fn target_filesearch ( & self , kind : PathKind ) -> filesearch:: FileSearch < ' _ > {
447
- filesearch :: FileSearch :: new ( & self . opts . search_paths , & self . target_tlib_path , kind )
450
+ pub fn target_filesearch ( & self ) -> & filesearch:: FileSearch {
451
+ & self . target_filesearch
448
452
}
449
- pub fn host_filesearch ( & self , kind : PathKind ) -> filesearch:: FileSearch < ' _ > {
450
- filesearch :: FileSearch :: new ( & self . opts . search_paths , & self . host_tlib_path , kind )
453
+ pub fn host_filesearch ( & self ) -> & filesearch:: FileSearch {
454
+ & self . host_filesearch
451
455
}
452
456
453
457
/// Returns a list of directories where target-specific tool binaries are located. Some fallback
@@ -1111,7 +1115,9 @@ pub fn build_session(
1111
1115
} ) ;
1112
1116
1113
1117
let asm_arch = if target. allow_asm { InlineAsmArch :: from_str ( & target. arch ) . ok ( ) } else { None } ;
1114
-
1118
+ let target_filesearch =
1119
+ filesearch:: FileSearch :: new ( & sopts. search_paths , & target_tlib_path, & target) ;
1120
+ let host_filesearch = filesearch:: FileSearch :: new ( & sopts. search_paths , & host_tlib_path, & host) ;
1115
1121
let sess = Session {
1116
1122
target,
1117
1123
host,
@@ -1138,6 +1144,8 @@ pub fn build_session(
1138
1144
cfg_version,
1139
1145
using_internal_features,
1140
1146
expanded_args,
1147
+ target_filesearch,
1148
+ host_filesearch,
1141
1149
} ;
1142
1150
1143
1151
validate_commandline_args_with_session_available ( & sess) ;
0 commit comments