summaryrefslogtreecommitdiffstats
path: root/tests/ui/try-block/try-block-in-edition2015.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/try-block/try-block-in-edition2015.rs')
-rw-r--r--tests/ui/try-block/try-block-in-edition2015.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/ui/try-block/try-block-in-edition2015.rs b/tests/ui/try-block/try-block-in-edition2015.rs
new file mode 100644
index 000000000..009642973
--- /dev/null
+++ b/tests/ui/try-block/try-block-in-edition2015.rs
@@ -0,0 +1,10 @@
+// compile-flags: --edition 2015
+
+pub fn main() {
+ let try_result: Option<_> = try {
+ //~^ ERROR expected struct, variant or union type, found macro `try`
+ let x = 5; //~ ERROR expected identifier, found keyword
+ x
+ };
+ assert_eq!(try_result, Some(5));
+}