File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -512,8 +512,10 @@ fn expand_item_mac(it: Gc<ast::Item>, fld: &mut MacroExpander)
512
512
513
513
let items = match expanded. make_def ( ) {
514
514
Some ( MacroDef { name, ext } ) => {
515
- // yikes... no idea how to apply the mark to this. I'm afraid
516
- // we're going to have to wait-and-see on this one.
515
+ // hidden invariant: this should only be possible as the
516
+ // result of expanding a LetSyntaxTT, and thus doesn't
517
+ // need to be marked. Not that it could be marked anyway.
518
+ // create issue to recommend refactoring here?
517
519
fld. extsbox . insert ( intern ( name. as_slice ( ) ) , ext) ;
518
520
if attr:: contains_name ( it. attrs . as_slice ( ) , "macro_export" ) {
519
521
SmallVector :: one ( it)
@@ -1466,6 +1468,15 @@ mod test {
1466
1468
0 )
1467
1469
}
1468
1470
1471
+ // macro_rules in method position
1472
+ #[ test] fn macro_in_method_posn ( ) {
1473
+ expand_crate_str (
1474
+ "macro_rules! my_method (() => fn thirteen(&self) -> int {13})
1475
+ struct A;
1476
+ impl A{ my_method!()}
1477
+ fn f(){A.thirteen;}" . to_string ( ) ) ;
1478
+ }
1479
+
1469
1480
// run one of the renaming tests
1470
1481
fn run_renaming_test ( t : & RenamingTest , test_idx : uint ) {
1471
1482
let invalid_name = token:: special_idents:: invalid. name ;
You can’t perform that action at this time.
0 commit comments