File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1849,3 +1849,16 @@ fn test_expand_bad_literal() {
1849
1849
)
1850
1850
. assert_expand_err ( r#"foo!(&k");"# , & ExpandError :: BindingError ( "" . into ( ) ) ) ;
1851
1851
}
1852
+
1853
+ #[ test]
1854
+ fn test_empty_comments ( ) {
1855
+ parse_macro (
1856
+ r#"
1857
+ macro_rules! one_arg_macro { ($fmt:expr) => (); }
1858
+ "# ,
1859
+ )
1860
+ . assert_expand_err (
1861
+ r#"one_arg_macro!(/**/)"# ,
1862
+ & ExpandError :: BindingError ( "expected Expr" . into ( ) ) ,
1863
+ ) ;
1864
+ }
Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ const COMMENT_PREFIX_TO_KIND: &[(&str, CommentKind)] = {
56
56
} ;
57
57
58
58
fn kind_by_prefix ( text : & str ) -> CommentKind {
59
+ if text == "/**/" {
60
+ return CommentKind { shape : CommentShape :: Block , doc : None } ;
61
+ }
59
62
for ( prefix, kind) in COMMENT_PREFIX_TO_KIND . iter ( ) {
60
63
if text. starts_with ( prefix) {
61
64
return * kind;
You can’t perform that action at this time.
0 commit comments