@@ -1373,24 +1373,29 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> {
1373
1373
result
1374
1374
}
1375
1375
// 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;
1376
1380
ast:: ItemKind :: Fn ( ..) if self . cx . ecfg . should_test => {
1377
1381
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 ( ) ;
1379
1384
1380
1385
// Publicize the item under gensymed name to avoid pollution
1381
1386
item = item. map ( |mut item| {
1382
1387
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 ( ) ;
1385
1389
item
1386
1390
} ) ;
1387
1391
1388
1392
// Use the gensymed name under the item's original visibility
1389
1393
let use_item = self . cx . item_use_simple_ (
1390
1394
item. ident . span ,
1391
1395
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] ) ) ;
1394
1399
1395
1400
SmallVector :: many (
1396
1401
self . fold_unnameable ( item) . into_iter ( )
0 commit comments