@@ -25,11 +25,11 @@ pub enum Platform {
2525 PluginAndTarget ,
2626}
2727
28- pub struct Context < ' a > {
29- pub config : & ' a Config ,
28+ pub struct Context < ' a , ' cfg : ' a > {
29+ pub config : & ' cfg Config ,
3030 pub resolve : & ' a Resolve ,
31- pub sources : & ' a SourceMap < ' a > ,
32- pub compilation : Compilation ,
31+ pub sources : & ' a SourceMap < ' cfg > ,
32+ pub compilation : Compilation < ' cfg > ,
3333 pub build_state : Arc < BuildState > ,
3434 pub exec_engine : Arc < Box < ExecEngine > > ,
3535 pub fingerprints : HashMap < ( & ' a PackageId , & ' a Target , & ' a Profile , Kind ) ,
@@ -49,23 +49,24 @@ pub struct Context<'a> {
4949 profiles : & ' a Profiles ,
5050}
5151
52- impl < ' a > Context < ' a > {
52+ impl < ' a , ' cfg > Context < ' a , ' cfg > {
5353 pub fn new ( resolve : & ' a Resolve ,
54- sources : & ' a SourceMap < ' a > ,
54+ sources : & ' a SourceMap < ' cfg > ,
5555 deps : & ' a PackageSet ,
56- config : & ' a Config ,
56+ config : & ' cfg Config ,
5757 host : Layout ,
5858 target_layout : Option < Layout > ,
5959 root_pkg : & Package ,
6060 build_config : BuildConfig ,
61- profiles : & ' a Profiles ) -> CargoResult < Context < ' a > > {
61+ profiles : & ' a Profiles ) -> CargoResult < Context < ' a , ' cfg > > {
6262 let target = build_config. requested_target . clone ( ) ;
6363 let target = target. as_ref ( ) . map ( |s| & s[ ..] ) ;
64- let ( target_dylib, target_exe) = try!( Context :: filename_parts ( target) ) ;
64+ let ( target_dylib, target_exe) = try!( Context :: filename_parts ( target,
65+ config) ) ;
6566 let ( host_dylib, host_exe) = if build_config. requested_target . is_none ( ) {
6667 ( target_dylib. clone ( ) , target_exe. clone ( ) )
6768 } else {
68- try!( Context :: filename_parts ( None ) )
69+ try!( Context :: filename_parts ( None , config ) )
6970 } ;
7071 let target_triple = target. unwrap_or ( config. rustc_host ( ) ) . to_string ( ) ;
7172 let engine = build_config. exec_engine . as_ref ( ) . cloned ( ) . unwrap_or ( {
@@ -84,7 +85,7 @@ impl<'a> Context<'a> {
8485 host_dylib : host_dylib,
8586 host_exe : host_exe,
8687 requirements : HashMap :: new ( ) ,
87- compilation : Compilation :: new ( root_pkg) ,
88+ compilation : Compilation :: new ( root_pkg, config ) ,
8889 build_state : Arc :: new ( BuildState :: new ( & build_config, deps) ) ,
8990 build_config : build_config,
9091 exec_engine : engine,
@@ -96,9 +97,9 @@ impl<'a> Context<'a> {
9697
9798 /// Run `rustc` to discover the dylib prefix/suffix for the target
9899 /// specified as well as the exe suffix
99- fn filename_parts ( target : Option < & str > )
100+ fn filename_parts ( target : Option < & str > , cfg : & Config )
100101 -> CargoResult < ( Option < ( String , String ) > , String ) > {
101- let mut process = try!( util:: process ( util :: rustc ( ) ) ) ;
102+ let mut process = try!( util:: process ( cfg . rustc ( ) ) ) ;
102103 process. arg ( "-" )
103104 . arg ( "--crate-name" ) . arg ( "_" )
104105 . arg ( "--crate-type" ) . arg ( "dylib" )
0 commit comments