@@ -59,7 +59,6 @@ struct TestCtxt<'a> {
5959 testfns : Vec < Test > ,
6060 reexport_test_harness_main : Option < InternedString > ,
6161 is_test_crate : bool ,
62- config : ast:: CrateConfig ,
6362
6463 // top-level re-export submodule, filled out after folding is finished
6564 toplevel_reexport : Option < ast:: Ident > ,
@@ -68,14 +67,9 @@ struct TestCtxt<'a> {
6867// Traverse the crate, collecting all the test functions, eliding any
6968// existing main functions, and synthesizing a main test harness
7069pub fn modify_for_testing ( sess : & ParseSess ,
71- cfg : & ast :: CrateConfig ,
70+ should_test : bool ,
7271 krate : ast:: Crate ,
7372 span_diagnostic : & errors:: Handler ) -> ast:: Crate {
74- // We generate the test harness when building in the 'test'
75- // configuration, either with the '--test' or '--cfg test'
76- // command line options.
77- let should_test = attr:: contains_name ( & krate. config , "test" ) ;
78-
7973 // Check for #[reexport_test_harness_main = "some_name"] which
8074 // creates a `use some_name = __test::main;`. This needs to be
8175 // unconditional, so that the attribute is still marked as used in
@@ -85,7 +79,7 @@ pub fn modify_for_testing(sess: &ParseSess,
8579 "reexport_test_harness_main" ) ;
8680
8781 if should_test {
88- generate_test_harness ( sess, reexport_test_harness_main, krate, cfg , span_diagnostic)
82+ generate_test_harness ( sess, reexport_test_harness_main, krate, span_diagnostic)
8983 } else {
9084 strip_test_functions ( krate)
9185 }
@@ -271,7 +265,6 @@ fn mk_reexport_mod(cx: &mut TestCtxt, tests: Vec<ast::Ident>,
271265fn generate_test_harness ( sess : & ParseSess ,
272266 reexport_test_harness_main : Option < InternedString > ,
273267 krate : ast:: Crate ,
274- cfg : & ast:: CrateConfig ,
275268 sd : & errors:: Handler ) -> ast:: Crate {
276269 // Remove the entry points
277270 let mut cleaner = EntryPointCleaner { depth : 0 } ;
@@ -281,14 +274,13 @@ fn generate_test_harness(sess: &ParseSess,
281274 let mut cx: TestCtxt = TestCtxt {
282275 sess : sess,
283276 span_diagnostic : sd,
284- ext_cx : ExtCtxt :: new ( sess, cfg . clone ( ) ,
277+ ext_cx : ExtCtxt :: new ( sess, vec ! [ ] ,
285278 ExpansionConfig :: default ( "test" . to_string ( ) ) ,
286279 & mut feature_gated_cfgs) ,
287280 path : Vec :: new ( ) ,
288281 testfns : Vec :: new ( ) ,
289282 reexport_test_harness_main : reexport_test_harness_main,
290283 is_test_crate : is_test_crate ( & krate) ,
291- config : krate. config . clone ( ) ,
292284 toplevel_reexport : None ,
293285 } ;
294286 cx. ext_cx . crate_root = Some ( "std" ) ;
0 commit comments