about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/test/ui/parser/expected-comma-found-token.rs22
-rw-r--r--src/test/ui/parser/expected-comma-found-token.stderr10
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/parser/expected-comma-found-token.rs b/src/test/ui/parser/expected-comma-found-token.rs
new file mode 100644
index 00000000000..3c53c3acf55
--- /dev/null
+++ b/src/test/ui/parser/expected-comma-found-token.rs
@@ -0,0 +1,22 @@
+// Copyright 2018 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.
+
+// Tests that two closures cannot simultaneously have mutable
+// access to the variable, whether that mutable access be used
+// for direct assignment or for taking mutable ref. Issue #6801.
+
+#![feature(on_unimplemented)]
+
+#[rustc_on_unimplemented(
+    message="the message"
+    label="the label"
+)]
+trait T {}
+//~^^^ ERROR expected one of `)` or `,`, found `label`
diff --git a/src/test/ui/parser/expected-comma-found-token.stderr b/src/test/ui/parser/expected-comma-found-token.stderr
new file mode 100644
index 00000000000..9a564bb872e
--- /dev/null
+++ b/src/test/ui/parser/expected-comma-found-token.stderr
@@ -0,0 +1,10 @@
+error: expected one of `)` or `,`, found `label`
+  --> $DIR/expected-comma-found-token.rs:19:5
+   |
+LL |     message="the message"
+   |                          - expected one of `)` or `,` here
+LL |     label="the label"
+   |     ^^^^^ unexpected token
+
+error: aborting due to previous error
+