about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAleksey Kladov <aleksey.kladov@gmail.com>2021-12-29 18:37:06 +0300
committerAleksey Kladov <aleksey.kladov@gmail.com>2021-12-29 18:37:06 +0300
commitad4b02ecc00977538cf7225a8b47cfc76d386221 (patch)
tree10f84c170f88939dab8aafaa1d7e5465f880d322
parent3f5fc05d6675394f46b7cdeb6803d7c7045e16ab (diff)
downloadrust-ad4b02ecc00977538cf7225a8b47cfc76d386221.tar.gz
rust-ad4b02ecc00977538cf7225a8b47cfc76d386221.zip
add automated semicolon insertion test
-rw-r--r--crates/hir_def/src/macro_expansion_tests/mbe.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/crates/hir_def/src/macro_expansion_tests/mbe.rs b/crates/hir_def/src/macro_expansion_tests/mbe.rs
index 466c85fc5b0..4bef508840d 100644
--- a/crates/hir_def/src/macro_expansion_tests/mbe.rs
+++ b/crates/hir_def/src/macro_expansion_tests/mbe.rs
@@ -300,6 +300,34 @@ fn baz() {
 }
 
 #[test]
+fn asi() {
+    // Thanks, Christopher!
+    //
+    // https://internals.rust-lang.org/t/understanding-decisions-behind-semicolons/15181/29
+    check(
+        r#"
+macro_rules! asi { ($($stmt:stmt)*) => ($($stmt)*); }
+
+fn main() {
+    asi! {
+        let a = 2
+        let b = 5
+        drop(b-a)
+        println!("{}", a+b)
+    }
+}
+"#,
+        expect![[r#"
+macro_rules! asi { ($($stmt:stmt)*) => ($($stmt)*); }
+
+fn main() {
+    let a = 2let b = 5drop(b-a)println!("{}", a+b)
+}
+"#]],
+    )
+}
+
+#[test]
 fn test_match_group_empty_fixed_token() {
     check(
         r#"