diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2017-07-26 18:59:07 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2017-07-26 18:59:07 +0300 |
| commit | dda30f690206870ed6f8fc14216e92cdc1f2687a (patch) | |
| tree | 2848e2502c4f6f195be82c9ea9079a283a9288d4 /src/test | |
| parent | bad58f27916e7e233cc2916dcc9167708077e792 (diff) | |
Better diagnostics and recovery for `mut ref` in patterns
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/mut-ref.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/mut-ref.stderr | 8 |
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 + |
