about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorWonwoo Choi <chwo9843@gmail.com>2017-09-05 18:25:42 +0900
committerWonwoo Choi <chwo9843@gmail.com>2017-09-05 18:25:42 +0900
commit258ec30116b1a80f4a9fb4b14aa22dd88eb8bf31 (patch)
tree48518456359974e635646609a63be0ca46db4233 /src
parenta3beb8fe61cb73c2eb3a2d47c87d3945a6f52865 (diff)
downloadrust-258ec30116b1a80f4a9fb4b14aa22dd88eb8bf31.tar.gz
rust-258ec30116b1a80f4a9fb4b14aa22dd88eb8bf31.zip
Expect pipe symbol after closure parameter lists
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax/parse/parser.rs2
-rw-r--r--src/test/compile-fail/issue-44021.rs16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1f033b25fe4..a52d0488307 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4699,7 +4699,7 @@ impl<'a> Parser<'a> {
                     SeqSep::trailing_allowed(token::Comma),
                     |p| p.parse_fn_block_arg()
                 );
-                self.bump();
+                self.expect(&token::BinOp(token::Or))?;
                 args
             }
         };
diff --git a/src/test/compile-fail/issue-44021.rs b/src/test/compile-fail/issue-44021.rs
new file mode 100644
index 00000000000..b6ec21b94c7
--- /dev/null
+++ b/src/test/compile-fail/issue-44021.rs
@@ -0,0 +1,16 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+struct MyStruct;
+impl MyStruct {
+    fn f() {|x, y} //~ ERROR expected one of `:`, `@`, or `|`, found `}`
+}
+
+fn main() {}