1
Fork 0

resolve, inconsistent binding mode: tweak wording.

This commit is contained in:
Mazdak Farrokhzad 2020-03-04 03:58:52 +01:00
parent 4ad6248825
commit cc9aad452a
10 changed files with 74 additions and 74 deletions

View file

@ -249,8 +249,7 @@ impl<'a> Resolver<'a> {
self.session, self.session,
span, span,
E0409, E0409,
"variable `{}` is bound in inconsistent \ "variable `{}` is bound inconsistently across alternatives separated by `|`",
ways within the same match arm",
variable_name variable_name
); );
err.span_label(span, "bound in different ways"); err.span_label(span, "bound in different ways");

View file

@ -1,4 +1,4 @@
error[E0409]: variable `y` is bound in inconsistent ways within the same match arm error[E0409]: variable `y` is bound inconsistently across alternatives separated by `|`
--> $DIR/E0409.rs:5:23 --> $DIR/E0409.rs:5:23
| |
LL | (0, ref y) | (y, 0) => {} LL | (0, ref y) | (y, 0) => {}

View file

@ -5,22 +5,22 @@
fn main() { fn main() {
// One level: // One level:
let Ok(a) | Err(ref a): Result<&u8, u8> = Ok(&0); let Ok(a) | Err(ref a): Result<&u8, u8> = Ok(&0);
//~^ ERROR variable `a` is bound in inconsistent ways //~^ ERROR variable `a` is bound inconsistently
let Ok(ref mut a) | Err(a): Result<u8, &mut u8> = Ok(0); let Ok(ref mut a) | Err(a): Result<u8, &mut u8> = Ok(0);
//~^ ERROR variable `a` is bound in inconsistent ways //~^ ERROR variable `a` is bound inconsistently
let Ok(ref a) | Err(ref mut a): Result<&u8, &mut u8> = Ok(&0); let Ok(ref a) | Err(ref mut a): Result<&u8, &mut u8> = Ok(&0);
//~^ ERROR variable `a` is bound in inconsistent ways //~^ ERROR variable `a` is bound inconsistently
//~| ERROR mismatched types //~| ERROR mismatched types
let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0)); let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
//~^ ERROR variable `a` is bound in inconsistent ways //~^ ERROR variable `a` is bound inconsistently
//~| ERROR variable `b` is bound in inconsistent ways //~| ERROR variable `b` is bound inconsistently
//~| ERROR mismatched types //~| ERROR mismatched types
// Two levels: // Two levels:
let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0); let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0);
//~^ ERROR variable `a` is bound in inconsistent ways //~^ ERROR variable `a` is bound inconsistently
// Three levels: // Three levels:
let Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a) = Err(&1); let Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a) = Err(&1);
//~^ ERROR variable `a` is bound in inconsistent ways //~^ ERROR variable `a` is bound inconsistently
} }

View file

@ -1,4 +1,4 @@
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:7:25 --> $DIR/inconsistent-modes.rs:7:25
| |
LL | let Ok(a) | Err(ref a): Result<&u8, u8> = Ok(&0); LL | let Ok(a) | Err(ref a): Result<&u8, u8> = Ok(&0);
@ -6,7 +6,7 @@ LL | let Ok(a) | Err(ref a): Result<&u8, u8> = Ok(&0);
| | | |
| first binding | first binding
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:9:29 --> $DIR/inconsistent-modes.rs:9:29
| |
LL | let Ok(ref mut a) | Err(a): Result<u8, &mut u8> = Ok(0); LL | let Ok(ref mut a) | Err(a): Result<u8, &mut u8> = Ok(0);
@ -14,25 +14,25 @@ LL | let Ok(ref mut a) | Err(a): Result<u8, &mut u8> = Ok(0);
| | | |
| first binding | first binding
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:11:33 --> $DIR/inconsistent-modes.rs:11:33
| |
LL | let Ok(ref a) | Err(ref mut a): Result<&u8, &mut u8> = Ok(&0); LL | let Ok(ref a) | Err(ref mut a): Result<&u8, &mut u8> = Ok(&0);
| - first binding ^ bound in different ways | - first binding ^ bound in different ways
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:14:39 --> $DIR/inconsistent-modes.rs:14:39
| |
LL | let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0)); LL | let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
| - first binding ^ bound in different ways | - first binding ^ bound in different ways
error[E0409]: variable `b` is bound in inconsistent ways within the same match arm error[E0409]: variable `b` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:14:46 --> $DIR/inconsistent-modes.rs:14:46
| |
LL | let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0)); LL | let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
| - first binding ^ bound in different ways | - first binding ^ bound in different ways
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:20:38 --> $DIR/inconsistent-modes.rs:20:38
| |
LL | let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0); LL | let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0);
@ -40,8 +40,8 @@ LL | let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0);
| | | |
| first binding | first binding
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
--> $DIR/inconsistent-modes.rs:24:34 --> $DIR/inconsistent-modes.rs:24:33
| |
LL | let Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a) = Err(&1); LL | let Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a) = Err(&1);
| - ^ bound in different ways | - ^ bound in different ways

View file

@ -1,11 +1,13 @@
enum Opts { enum Opts {
A(isize), B(isize), C(isize) A(isize),
B(isize),
C(isize),
} }
fn matcher1(x: Opts) { fn matcher1(x: Opts) {
match x { match x {
Opts::A(ref i) | Opts::B(i) => {} Opts::A(ref i) | Opts::B(i) => {}
//~^ ERROR variable `i` is bound in inconsistent ways within the same match arm //~^ ERROR variable `i` is bound inconsistently
//~^^ ERROR mismatched types //~^^ ERROR mismatched types
Opts::C(_) => {} Opts::C(_) => {}
} }
@ -14,7 +16,7 @@ fn matcher1(x: Opts) {
fn matcher2(x: Opts) { fn matcher2(x: Opts) {
match x { match x {
Opts::A(ref i) | Opts::B(i) => {} Opts::A(ref i) | Opts::B(i) => {}
//~^ ERROR variable `i` is bound in inconsistent ways within the same match arm //~^ ERROR variable `i` is bound inconsistently
//~^^ ERROR mismatched types //~^^ ERROR mismatched types
Opts::C(_) => {} Opts::C(_) => {}
} }
@ -23,13 +25,12 @@ fn matcher2(x: Opts) {
fn matcher4(x: Opts) { fn matcher4(x: Opts) {
match x { match x {
Opts::A(ref mut i) | Opts::B(ref i) => {} Opts::A(ref mut i) | Opts::B(ref i) => {}
//~^ ERROR variable `i` is bound in inconsistent ways within the same match arm //~^ ERROR variable `i` is bound inconsistently
//~^^ ERROR mismatched types //~^^ ERROR mismatched types
Opts::C(_) => {} Opts::C(_) => {}
} }
} }
fn matcher5(x: Opts) { fn matcher5(x: Opts) {
match x { match x {
Opts::A(ref i) | Opts::B(ref i) => {} Opts::A(ref i) | Opts::B(ref i) => {}

View file

@ -1,27 +1,27 @@
error[E0409]: variable `i` is bound in inconsistent ways within the same match arm error[E0409]: variable `i` is bound inconsistently across alternatives separated by `|`
--> $DIR/resolve-inconsistent-binding-mode.rs:7:32 --> $DIR/resolve-inconsistent-binding-mode.rs:9:34
| |
LL | Opts::A(ref i) | Opts::B(i) => {} LL | Opts::A(ref i) | Opts::B(i) => {}
| - ^ bound in different ways | - ^ bound in different ways
| | | |
| first binding | first binding
error[E0409]: variable `i` is bound in inconsistent ways within the same match arm error[E0409]: variable `i` is bound inconsistently across alternatives separated by `|`
--> $DIR/resolve-inconsistent-binding-mode.rs:16:32 --> $DIR/resolve-inconsistent-binding-mode.rs:18:34
| |
LL | Opts::A(ref i) | Opts::B(i) => {} LL | Opts::A(ref i) | Opts::B(i) => {}
| - ^ bound in different ways | - ^ bound in different ways
| | | |
| first binding | first binding
error[E0409]: variable `i` is bound in inconsistent ways within the same match arm error[E0409]: variable `i` is bound inconsistently across alternatives separated by `|`
--> $DIR/resolve-inconsistent-binding-mode.rs:25:40 --> $DIR/resolve-inconsistent-binding-mode.rs:27:42
| |
LL | Opts::A(ref mut i) | Opts::B(ref i) => {} LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
| - first binding ^ bound in different ways | - first binding ^ bound in different ways
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/resolve-inconsistent-binding-mode.rs:7:32 --> $DIR/resolve-inconsistent-binding-mode.rs:9:34
| |
LL | match x { LL | match x {
| - this expression has type `Opts` | - this expression has type `Opts`
@ -33,7 +33,7 @@ LL | Opts::A(ref i) | Opts::B(i) => {}
= note: in the same arm, a binding must have the same type in all alternatives = note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/resolve-inconsistent-binding-mode.rs:16:32 --> $DIR/resolve-inconsistent-binding-mode.rs:18:34
| |
LL | match x { LL | match x {
| - this expression has type `Opts` | - this expression has type `Opts`
@ -45,7 +45,7 @@ LL | Opts::A(ref i) | Opts::B(i) => {}
= note: in the same arm, a binding must have the same type in all alternatives = note: in the same arm, a binding must have the same type in all alternatives
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/resolve-inconsistent-binding-mode.rs:25:36 --> $DIR/resolve-inconsistent-binding-mode.rs:27:38
| |
LL | match x { LL | match x {
| - this expression has type `Opts` | - this expression has type `Opts`

View file

@ -19,7 +19,7 @@ fn main() {
(A, B) | (ref B, c) | (c, A) => () (A, B) | (ref B, c) | (c, A) => ()
//~^ ERROR variable `A` is not bound in all patterns //~^ ERROR variable `A` is not bound in all patterns
//~| ERROR variable `B` is not bound in all patterns //~| ERROR variable `B` is not bound in all patterns
//~| ERROR variable `B` is bound in inconsistent ways //~| ERROR variable `B` is bound inconsistently
//~| ERROR mismatched types //~| ERROR mismatched types
//~| ERROR variable `c` is not bound in all patterns //~| ERROR variable `c` is not bound in all patterns
//~| HELP consider making the path in the pattern qualified: `?::A` //~| HELP consider making the path in the pattern qualified: `?::A`

View file

@ -47,7 +47,7 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
| | variable not in all patterns | | variable not in all patterns
| pattern doesn't bind `c` | pattern doesn't bind `c`
error[E0409]: variable `B` is bound in inconsistent ways within the same match arm error[E0409]: variable `B` is bound inconsistently across alternatives separated by `|`
--> $DIR/resolve-inconsistent-names.rs:19:23 --> $DIR/resolve-inconsistent-names.rs:19:23
| |
LL | (A, B) | (ref B, c) | (c, A) => () LL | (A, B) | (ref B, c) | (c, A) => ()

View file

@ -4,7 +4,7 @@ pub fn main() {
let x = &Some((3, 3)); let x = &Some((3, 3));
let _: &i32 = match x { let _: &i32 = match x {
Some((x, 3)) | &Some((ref x, 5)) => x, Some((x, 3)) | &Some((ref x, 5)) => x,
//~^ ERROR is bound in inconsistent ways //~^ ERROR is bound inconsistently
_ => &5i32, _ => &5i32,
}; };
} }

View file

@ -1,4 +1,4 @@
error[E0409]: variable `x` is bound in inconsistent ways within the same match arm error[E0409]: variable `x` is bound inconsistently across alternatives separated by `|`
--> $DIR/issue-44912-or.rs:6:35 --> $DIR/issue-44912-or.rs:6:35
| |
LL | Some((x, 3)) | &Some((ref x, 5)) => x, LL | Some((x, 3)) | &Some((ref x, 5)) => x,