about summary refs log tree commit diff
path: root/src/tools/rustfmt/tests/source/catch.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rustfmt/tests/source/catch.rs')
-rw-r--r--src/tools/rustfmt/tests/source/catch.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/source/catch.rs b/src/tools/rustfmt/tests/source/catch.rs
new file mode 100644
index 00000000000..541db1dc90c
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/catch.rs
@@ -0,0 +1,28 @@
+// rustfmt-edition: 2018
+#![feature(try_blocks)]
+
+fn main() {
+    let x = try {
+        foo()?
+    };
+
+    let x = try /* Invisible comment */ { foo()? };
+
+    let x = try {
+        unsafe { foo()? }
+    };
+
+    let y = match (try {
+        foo()?
+    }) {
+        _ => (),
+    };
+
+    try {
+        foo()?;
+    };
+
+    try {
+        // Regular try block
+    };
+}