@@ -28,7 +28,7 @@ use rustc::session::config::{OutputType, OutputTypes, Externs};
2828use rustc:: session:: search_paths:: { SearchPaths , PathKind } ;
2929use rustc_metadata:: dynamic_lib:: DynamicLibrary ;
3030use tempdir:: TempDir ;
31- use rustc_driver:: { self , driver, Compilation } ;
31+ use rustc_driver:: { self , driver, target_features , Compilation } ;
3232use rustc_driver:: driver:: phase_2_configure_and_expand;
3333use rustc_metadata:: cstore:: CStore ;
3434use rustc_resolve:: MakeGlobMap ;
@@ -96,8 +96,10 @@ pub fn run(input_path: &Path,
9696 let trans = rustc_driver:: get_trans ( & sess) ;
9797 let cstore = CStore :: new ( trans. metadata_loader ( ) ) ;
9898 rustc_lint:: register_builtins ( & mut sess. lint_store . borrow_mut ( ) , Some ( & sess) ) ;
99- sess. parse_sess . config =
100- config:: build_configuration ( & sess, config:: parse_cfgspecs ( cfgs. clone ( ) ) ) ;
99+
100+ let mut cfg = config:: build_configuration ( & sess, config:: parse_cfgspecs ( cfgs. clone ( ) ) ) ;
101+ target_features:: add_configuration ( & mut cfg, & sess, & * trans) ;
102+ sess. parse_sess . config = cfg;
101103
102104 let krate = panictry ! ( driver:: phase_1_parse_input( & driver:: CompileController :: basic( ) ,
103105 & sess,
@@ -271,8 +273,11 @@ fn run_test(test: &str, cratename: &str, filename: &FileName, line: usize,
271273 let outdir = Mutex :: new ( TempDir :: new ( "rustdoctest" ) . ok ( ) . expect ( "rustdoc needs a tempdir" ) ) ;
272274 let libdir = sess. target_filesearch ( PathKind :: All ) . get_lib_path ( ) ;
273275 let mut control = driver:: CompileController :: basic ( ) ;
274- sess. parse_sess . config =
275- config:: build_configuration ( & sess, config:: parse_cfgspecs ( cfgs. clone ( ) ) ) ;
276+
277+ let mut cfg = config:: build_configuration ( & sess, config:: parse_cfgspecs ( cfgs. clone ( ) ) ) ;
278+ target_features:: add_configuration ( & mut cfg, & sess, & * trans) ;
279+ sess. parse_sess . config = cfg;
280+
276281 let out = Some ( outdir. lock ( ) . unwrap ( ) . path ( ) . to_path_buf ( ) ) ;
277282
278283 if no_run {
0 commit comments