summaryrefslogtreecommitdiffstats
path: root/src/test/ui/try-block/try-block-in-edition2015.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/try-block/try-block-in-edition2015.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/try-block/try-block-in-edition2015.rs b/src/test/ui/try-block/try-block-in-edition2015.rs
new file mode 100644
index 000000000..009642973
--- /dev/null
+++ b/src/test/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));
+}