summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/missing-fat-arrow.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/parser/missing-fat-arrow.rs38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/ui/parser/missing-fat-arrow.rs b/tests/ui/parser/missing-fat-arrow.rs
new file mode 100644
index 000000000..325f1ccf2
--- /dev/null
+++ b/tests/ui/parser/missing-fat-arrow.rs
@@ -0,0 +1,38 @@
+fn main() {
+ let x = 1;
+ let y = 2;
+ let value = 3;
+
+ match value {
+ Some(x) if x == y {
+ self.next_token()?; //~ ERROR expected identifier, found keyword `self`
+ },
+ _ => {}
+ }
+ let _: i32 = (); //~ ERROR mismatched types
+}
+
+struct Foo {
+ value: usize
+}
+
+fn foo(a: Option<&mut Foo>, b: usize) {
+ match a {
+ Some(a) if a.value == b {
+ a.value = 1; //~ ERROR expected one of `,`, `:`, or `}`, found `.`
+ },
+ _ => {}
+ }
+ let _: i32 = (); //~ ERROR mismatched types
+}
+
+fn bar(a: Option<&mut Foo>, b: usize) {
+ match a {
+ Some(a) if a.value == b {
+ a.value, //~ ERROR expected one of `,`, `:`, or `}`, found `.`
+ } => {
+ }
+ _ => {}
+ }
+ let _: i32 = (); //~ ERROR mismatched types
+}