aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_mbe/src/tests.rs13
-rw-r--r--crates/ra_syntax/src/ast/tokens.rs3
2 files changed, 16 insertions, 0 deletions
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs
index 100ed41f2..364dcc3c3 100644
--- a/crates/ra_mbe/src/tests.rs
+++ b/crates/ra_mbe/src/tests.rs
@@ -1849,3 +1849,16 @@ fn test_expand_bad_literal() {
1849 ) 1849 )
1850 .assert_expand_err(r#"foo!(&k");"#, &ExpandError::BindingError("".into())); 1850 .assert_expand_err(r#"foo!(&k");"#, &ExpandError::BindingError("".into()));
1851} 1851}
1852
1853#[test]
1854fn 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}
diff --git a/crates/ra_syntax/src/ast/tokens.rs b/crates/ra_syntax/src/ast/tokens.rs
index e8320b57e..a60768056 100644
--- a/crates/ra_syntax/src/ast/tokens.rs
+++ b/crates/ra_syntax/src/ast/tokens.rs
@@ -56,6 +56,9 @@ const COMMENT_PREFIX_TO_KIND: &[(&str, CommentKind)] = {
56}; 56};
57 57
58fn kind_by_prefix(text: &str) -> CommentKind { 58fn kind_by_prefix(text: &str) -> CommentKind {
59 if text == "/**/" {
60 return CommentKind { shape: CommentShape::Block, doc: None };
61 }
59 for (prefix, kind) in COMMENT_PREFIX_TO_KIND.iter() { 62 for (prefix, kind) in COMMENT_PREFIX_TO_KIND.iter() {
60 if text.starts_with(prefix) { 63 if text.starts_with(prefix) {
61 return *kind; 64 return *kind;