Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir_def/src/macro_expansion_tests/mbe/matching.rs')
| -rw-r--r-- | crates/hir_def/src/macro_expansion_tests/mbe/matching.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests/mbe/matching.rs b/crates/hir_def/src/macro_expansion_tests/mbe/matching.rs index 5bdabfc598..9fb6d96b72 100644 --- a/crates/hir_def/src/macro_expansion_tests/mbe/matching.rs +++ b/crates/hir_def/src/macro_expansion_tests/mbe/matching.rs @@ -23,3 +23,30 @@ literal!(); "#]], ) } + +#[test] +fn test_expand_bad_literal() { + check( + r#" +macro_rules! m { ($i:literal) => {}; } +m!(&k"); +"#, + expect![[r#" +macro_rules! m { ($i:literal) => {}; } +/* error: Failed to lower macro args to token tree */"#]], + ); +} + +#[test] +fn test_empty_comments() { + check( + r#" +macro_rules! m{ ($fmt:expr) => (); } +m!(/**/); +"#, + expect![[r#" +macro_rules! m{ ($fmt:expr) => (); } +/* error: expected Expr */ +"#]], + ); +} |