@@ -1373,24 +1373,29 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> {
13731373 result
13741374 }
13751375 // Ensure that test functions are accessible from the test harness.
1376+ // #[test] fn foo() {}
1377+ // becomes:
1378+ // #[test] pub fn foo_gensym(){}
1379+ // use foo_gensym as foo;
13761380 ast:: ItemKind :: Fn ( ..) if self . cx . ecfg . should_test => {
13771381 if self . tests_nameable && item. attrs . iter ( ) . any ( |attr| is_test_or_bench ( attr) ) {
1378- let orig_vis = item. vis . clone ( ) ;
1382+ let orig_ident = item. ident ;
1383+ let orig_vis = item. vis . clone ( ) ;
13791384
13801385 // Publicize the item under gensymed name to avoid pollution
13811386 item = item. map ( |mut item| {
13821387 item. vis = respan ( item. vis . span , ast:: VisibilityKind :: Public ) ;
1383- item. ident = Ident :: from_interned_str (
1384- item. ident . as_interned_str ( ) ) . gensym ( ) ;
1388+ item. ident = item. ident . gensym ( ) ;
13851389 item
13861390 } ) ;
13871391
13881392 // Use the gensymed name under the item's original visibility
13891393 let use_item = self . cx . item_use_simple_ (
13901394 item. ident . span ,
13911395 orig_vis,
1392- Some ( Ident :: from_interned_str ( item. ident . as_interned_str ( ) ) ) ,
1393- self . cx . path ( item. ident . span , vec ! [ Ident :: from_str( "self" ) , item. ident] ) ) ;
1396+ Some ( orig_ident) ,
1397+ self . cx . path ( item. ident . span ,
1398+ vec ! [ keywords:: SelfValue . ident( ) , item. ident] ) ) ;
13941399
13951400 SmallVector :: many (
13961401 self . fold_unnameable ( item) . into_iter ( )
0 commit comments