diff options
| author | kennytm <kennytm@gmail.com> | 2018-03-13 00:54:32 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-03-13 00:54:32 +0800 |
| commit | 14574db7931285af2d3316dff8e726ca8eccf862 (patch) | |
| tree | c21893274175e3ab05b696cff0ff7cd8817d5bc0 /src/test/ui | |
| parent | 2d13cc4d79028166f372c14734d991c98e24e517 (diff) | |
| parent | 9b599856a4b7e375e4e54eb759c250be969f5562 (diff) | |
| download | rust-14574db7931285af2d3316dff8e726ca8eccf862.tar.gz rust-14574db7931285af2d3316dff8e726ca8eccf862.zip | |
Rollup merge of #48928 - zackmdavis:span_suggestion_field_day, r=estebank
in which some labels and notes are upgraded to structured suggestions (Meanwhile, a couple of parse-fail tests are moved to UI tests so that the reader can see the new output, and an existing UI test is given a more evocative name.) r? @estebank
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.rs (renamed from src/test/ui/did_you_mean/issue-41679.rs) | 2 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/issue-41679.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/match-refactor-to-expr.rs | 22 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/match-refactor-to-expr.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/pub-macro-rules.rs | 26 | ||||
| -rw-r--r-- | src/test/ui/did_you_mean/pub-macro-rules.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/issue-11004.stderr | 8 |
8 files changed, 80 insertions, 17 deletions
diff --git a/src/test/ui/did_you_mean/issue-41679.rs b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.rs index 98c909e212f..e8fd248011c 100644 --- a/src/test/ui/did_you_mean/issue-41679.rs +++ b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let x = ~1; //~ ERROR can not be used as a unary operator + let x = ~1; //~ ERROR cannot be used as a unary operator } diff --git a/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr new file mode 100644 index 00000000000..f13f15f6377 --- /dev/null +++ b/src/test/ui/did_you_mean/issue-41679-tilde-bitwise-negation-attempt.stderr @@ -0,0 +1,8 @@ +error: `~` cannot be used as a unary operator + --> $DIR/issue-41679-tilde-bitwise-negation-attempt.rs:12:13 + | +LL | let x = ~1; //~ ERROR cannot be used as a unary operator + | ^ help: use `!` to perform bitwise negation + +error: aborting due to previous error + diff --git a/src/test/ui/did_you_mean/issue-41679.stderr b/src/test/ui/did_you_mean/issue-41679.stderr deleted file mode 100644 index c17812fc0cb..00000000000 --- a/src/test/ui/did_you_mean/issue-41679.stderr +++ /dev/null @@ -1,10 +0,0 @@ -error: `~` can not be used as a unary operator - --> $DIR/issue-41679.rs:12:13 - | -LL | let x = ~1; //~ ERROR can not be used as a unary operator - | ^ did you mean `!`? - | - = help: use `!` instead of `~` if you meant to perform bitwise negation - -error: aborting due to previous error - diff --git a/src/test/ui/did_you_mean/match-refactor-to-expr.rs b/src/test/ui/did_you_mean/match-refactor-to-expr.rs new file mode 100644 index 00000000000..3c88608697a --- /dev/null +++ b/src/test/ui/did_you_mean/match-refactor-to-expr.rs @@ -0,0 +1,22 @@ +// Copyright 2015 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 foo = + match + Some(4).unwrap_or_else(5) + //~^ NOTE expected one of `.`, `?`, `{`, or an operator here + ; //~ NOTE unexpected token + //~^ ERROR expected one of `.`, `?`, `{`, or an operator, found `;` + + println!("{}", foo) +} diff --git a/src/test/ui/did_you_mean/match-refactor-to-expr.stderr b/src/test/ui/did_you_mean/match-refactor-to-expr.stderr new file mode 100644 index 00000000000..ecca781684c --- /dev/null +++ b/src/test/ui/did_you_mean/match-refactor-to-expr.stderr @@ -0,0 +1,13 @@ +error: expected one of `.`, `?`, `{`, or an operator, found `;` + --> $DIR/match-refactor-to-expr.rs:18:9 + | +LL | match + | ----- help: try removing this `match` +LL | Some(4).unwrap_or_else(5) + | - expected one of `.`, `?`, `{`, or an operator here +LL | //~^ NOTE expected one of `.`, `?`, `{`, or an operator here +LL | ; //~ NOTE unexpected token + | ^ unexpected token + +error: aborting due to previous error + diff --git a/src/test/ui/did_you_mean/pub-macro-rules.rs b/src/test/ui/did_you_mean/pub-macro-rules.rs new file mode 100644 index 00000000000..65a0d642cd7 --- /dev/null +++ b/src/test/ui/did_you_mean/pub-macro-rules.rs @@ -0,0 +1,26 @@ +// Copyright 2015 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. + +#[macro_use] mod bleh { + pub macro_rules! foo { //~ ERROR can't qualify macro_rules invocation + ($n:ident) => ( + fn $n () -> i32 { + 1 + } + ) + } + +} + +foo!(meh); + +fn main() { + println!("{}", meh()); +} diff --git a/src/test/ui/did_you_mean/pub-macro-rules.stderr b/src/test/ui/did_you_mean/pub-macro-rules.stderr new file mode 100644 index 00000000000..dfeab75525b --- /dev/null +++ b/src/test/ui/did_you_mean/pub-macro-rules.stderr @@ -0,0 +1,8 @@ +error: can't qualify macro_rules invocation with `pub` + --> $DIR/pub-macro-rules.rs:12:5 + | +LL | pub macro_rules! foo { //~ ERROR can't qualify macro_rules invocation + | ^^^ help: try exporting the macro: `#[macro_export]` + +error: aborting due to previous error + diff --git a/src/test/ui/issue-11004.stderr b/src/test/ui/issue-11004.stderr index 4cfc7d23bd0..268c3cd6d2a 100644 --- a/src/test/ui/issue-11004.stderr +++ b/src/test/ui/issue-11004.stderr @@ -2,17 +2,13 @@ error[E0609]: no field `x` on type `*mut A` --> $DIR/issue-11004.rs:17:21 | LL | let x : i32 = n.x; //~ no field `x` on type `*mut A` - | ^ - | - = note: `n` is a native pointer; perhaps you need to deref with `(*n).x` + | ^ help: `n` is a native pointer; try dereferencing it: `(*n).x` error[E0609]: no field `y` on type `*mut A` --> $DIR/issue-11004.rs:18:21 | LL | let y : f64 = n.y; //~ no field `y` on type `*mut A` - | ^ - | - = note: `n` is a native pointer; perhaps you need to deref with `(*n).y` + | ^ help: `n` is a native pointer; try dereferencing it: `(*n).y` error: aborting due to 2 previous errors |
