about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-07-26 18:59:07 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2017-07-26 18:59:07 +0300
commitdda30f690206870ed6f8fc14216e92cdc1f2687a (patch)
tree2848e2502c4f6f195be82c9ea9079a283a9288d4 /src/test
parentbad58f27916e7e233cc2916dcc9167708077e792 (diff)
Better diagnostics and recovery for `mut ref` in patterns
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/mut-ref.rs16
-rw-r--r--src/test/ui/mut-ref.stderr8
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/mut-ref.rs b/src/test/ui/mut-ref.rs
new file mode 100644
index 00000000000..f8883699688
--- /dev/null
+++ b/src/test/ui/mut-ref.rs
@@ -0,0 +1,16 @@
+// Copyright 2017 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.
+
+// compile-flags: -Z parse-only
+
+fn main() {
+    let mut ref x = 10;
+    let ref mut y = 11;
+}
diff --git a/src/test/ui/mut-ref.stderr b/src/test/ui/mut-ref.stderr
new file mode 100644
index 00000000000..ce6a42f1e5e
--- /dev/null
+++ b/src/test/ui/mut-ref.stderr
@@ -0,0 +1,8 @@
+error: the order of `mut` and `ref` is incorrect
+  --> $DIR/mut-ref.rs:14:9
+   |
+14 |     let mut ref x = 10;
+   |         ^^^^^^^ help: try switching the order: `ref mut`
+
+error: aborting due to previous error
+