File tree 2 files changed +20
-22
lines changed
hir_def/src/macro_expansion_tests 2 files changed +20
-22
lines changed Original file line number Diff line number Diff line change @@ -595,3 +595,23 @@ fn bar() {}
595
595
"# ] ] ,
596
596
) ;
597
597
}
598
+
599
+ #[ test]
600
+ fn test_parse_macro_def_rules ( ) {
601
+ cov_mark:: check!( parse_macro_def_rules) ;
602
+
603
+ check (
604
+ r#"
605
+ macro m {
606
+ ($id:ident) => { fn $id() {} }
607
+ }
608
+ m!(bar);
609
+ "# ,
610
+ expect ! [ [ r#"
611
+ macro m {
612
+ ($id:ident) => { fn $id() {} }
613
+ }
614
+ fn bar() {}
615
+ "# ] ] ,
616
+ ) ;
617
+ }
Original file line number Diff line number Diff line change @@ -77,12 +77,6 @@ fn to_subtree(tt: &tt::TokenTree) -> &tt::Subtree {
77
77
}
78
78
unreachable ! ( "It is not a subtree" ) ;
79
79
}
80
- fn to_literal ( tt : & tt:: TokenTree ) -> & tt:: Literal {
81
- if let tt:: TokenTree :: Leaf ( tt:: Leaf :: Literal ( lit) ) = tt {
82
- return lit;
83
- }
84
- unreachable ! ( "It is not a literal" ) ;
85
- }
86
80
87
81
fn to_punct ( tt : & tt:: TokenTree ) -> & tt:: Punct {
88
82
if let tt:: TokenTree :: Leaf ( tt:: Leaf :: Punct ( lit) ) = tt {
@@ -107,22 +101,6 @@ fn test_attr_to_token_tree() {
107
101
) ;
108
102
}
109
103
110
- #[ test]
111
- fn test_parse_macro_def_rules ( ) {
112
- cov_mark:: check!( parse_macro_def_rules) ;
113
-
114
- parse_macro2 (
115
- r#"
116
- macro foo {
117
- ($id:ident) => {
118
- fn $id() {}
119
- }
120
- }
121
- "# ,
122
- )
123
- . assert_expand_items ( "foo!(bar);" , "fn bar () {}" ) ;
124
- }
125
-
126
104
#[ test]
127
105
fn test_macro_2_0_panic_2015 ( ) {
128
106
parse_macro2 (
You can’t perform that action at this time.
0 commit comments