File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -1387,6 +1387,28 @@ mod test {
1387
1387
0 )
1388
1388
}
1389
1389
1390
+ // closure arg hygiene
1391
+ // expands to fn f(){(|x_1 : int| {(x_2 + x_1)})(3);}
1392
+ #[ test] fn closure_arg_hygiene ( ) {
1393
+ run_renaming_test (
1394
+ & ( "macro_rules! inject_x (()=>(x))
1395
+ fn f(){(|x : int| {(inject_x!() + x)})(3);}" ,
1396
+ vec ! ( vec!( 1 ) ) ,
1397
+ true ) ,
1398
+ 0 )
1399
+ }
1400
+
1401
+ // closure arg hygiene (ExprProc)
1402
+ // expands to fn f(){(proc(x_1 : int) {(x_2 + x_1)})(3);}
1403
+ #[ test] fn closure_arg_hygiene_2 ( ) {
1404
+ run_renaming_test (
1405
+ & ( "macro_rules! inject_x (()=>(x))
1406
+ fn f(){ (proc(x : int){(inject_x!() + x)})(3); }" ,
1407
+ vec ! ( vec!( 1 ) ) ,
1408
+ true ) ,
1409
+ 0 )
1410
+ }
1411
+
1390
1412
// run one of the renaming tests
1391
1413
fn run_renaming_test ( t : & RenamingTest , test_idx : uint ) {
1392
1414
let invalid_name = token:: special_idents:: invalid. name ;
You can’t perform that action at this time.
0 commit comments