resolve, inconsistent binding mode: tweak wording.
This commit is contained in:
parent
4ad6248825
commit
cc9aad452a
10 changed files with 74 additions and 74 deletions
|
@ -249,8 +249,7 @@ impl<'a> Resolver<'a> {
|
|||
self.session,
|
||||
span,
|
||||
E0409,
|
||||
"variable `{}` is bound in inconsistent \
|
||||
ways within the same match arm",
|
||||
"variable `{}` is bound inconsistently across alternatives separated by `|`",
|
||||
variable_name
|
||||
);
|
||||
err.span_label(span, "bound in different ways");
|
||||
|
|
|
@ -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
|
||||
|
|
||||
LL | (0, ref y) | (y, 0) => {}
|
||||
|
|
|
@ -5,22 +5,22 @@
|
|||
fn main() {
|
||||
// One level:
|
||||
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);
|
||||
//~^ 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);
|
||||
//~^ ERROR variable `a` is bound in inconsistent ways
|
||||
//~^ ERROR variable `a` is bound inconsistently
|
||||
//~| ERROR mismatched types
|
||||
let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
|
||||
//~^ ERROR variable `a` is bound in inconsistent ways
|
||||
//~| ERROR variable `b` is bound in inconsistent ways
|
||||
//~^ ERROR variable `a` is bound inconsistently
|
||||
//~| ERROR variable `b` is bound inconsistently
|
||||
//~| ERROR mismatched types
|
||||
|
||||
// Two levels:
|
||||
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:
|
||||
let Ok([ Ok((Ok(ref a) | Err(a),)) | Err(a) ]) | Err(a) = Err(&1);
|
||||
//~^ ERROR variable `a` is bound in inconsistent ways
|
||||
let Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a) = Err(&1);
|
||||
//~^ ERROR variable `a` is bound inconsistently
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
||||
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
|
||||
|
||||
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
|
||||
|
|
||||
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
|
||||
|
||||
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
|
||||
|
|
||||
LL | let Ok(ref a) | Err(ref mut a): Result<&u8, &mut u8> = Ok(&0);
|
||||
| - 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
|
||||
|
|
||||
LL | let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
|
||||
| - 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
|
||||
|
|
||||
LL | let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
|
||||
| - 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
|
||||
|
|
||||
LL | let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0);
|
||||
|
@ -40,10 +40,10 @@ LL | let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0);
|
|||
| |
|
||||
| first binding
|
||||
|
||||
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm
|
||||
--> $DIR/inconsistent-modes.rs:24:34
|
||||
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
|
||||
--> $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
|
||||
| |
|
||||
| first binding
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
enum Opts {
|
||||
A(isize), B(isize), C(isize)
|
||||
A(isize),
|
||||
B(isize),
|
||||
C(isize),
|
||||
}
|
||||
|
||||
fn matcher1(x: Opts) {
|
||||
match x {
|
||||
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
|
||||
Opts::C(_) => {}
|
||||
}
|
||||
|
@ -14,7 +16,7 @@ fn matcher1(x: Opts) {
|
|||
fn matcher2(x: Opts) {
|
||||
match x {
|
||||
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
|
||||
Opts::C(_) => {}
|
||||
}
|
||||
|
@ -23,13 +25,12 @@ fn matcher2(x: Opts) {
|
|||
fn matcher4(x: Opts) {
|
||||
match x {
|
||||
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
|
||||
Opts::C(_) => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fn matcher5(x: Opts) {
|
||||
match x {
|
||||
Opts::A(ref i) | Opts::B(ref i) => {}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
error[E0409]: variable `i` is bound in inconsistent ways within the same match arm
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:7:32
|
||||
error[E0409]: variable `i` is bound inconsistently across alternatives separated by `|`
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:9:34
|
||||
|
|
||||
LL | Opts::A(ref i) | Opts::B(i) => {}
|
||||
| - ^ bound in different ways
|
||||
| |
|
||||
| first binding
|
||||
|
||||
error[E0409]: variable `i` is bound in inconsistent ways within the same match arm
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:16:32
|
||||
error[E0409]: variable `i` is bound inconsistently across alternatives separated by `|`
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:18:34
|
||||
|
|
||||
LL | Opts::A(ref i) | Opts::B(i) => {}
|
||||
| - ^ bound in different ways
|
||||
| |
|
||||
| first binding
|
||||
|
||||
error[E0409]: variable `i` is bound in inconsistent ways within the same match arm
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:25:40
|
||||
error[E0409]: variable `i` is bound inconsistently across alternatives separated by `|`
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:27:42
|
||||
|
|
||||
LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
|
||||
| - first binding ^ bound in different ways
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:7:32
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:9:34
|
||||
|
|
||||
LL | match x {
|
||||
| - 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
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:16:32
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:18:34
|
||||
|
|
||||
LL | match x {
|
||||
| - 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
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:25:36
|
||||
--> $DIR/resolve-inconsistent-binding-mode.rs:27:38
|
||||
|
|
||||
LL | match x {
|
||||
| - this expression has type `Opts`
|
||||
|
|
|
@ -19,7 +19,7 @@ fn main() {
|
|||
(A, B) | (ref B, c) | (c, A) => ()
|
||||
//~^ ERROR variable `A` 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 variable `c` is not bound in all patterns
|
||||
//~| HELP consider making the path in the pattern qualified: `?::A`
|
||||
|
|
|
@ -47,7 +47,7 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
|
|||
| | variable not in all patterns
|
||||
| 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
|
||||
|
|
||||
LL | (A, B) | (ref B, c) | (c, A) => ()
|
||||
|
|
|
@ -4,7 +4,7 @@ pub fn main() {
|
|||
let x = &Some((3, 3));
|
||||
let _: &i32 = match x {
|
||||
Some((x, 3)) | &Some((ref x, 5)) => x,
|
||||
//~^ ERROR is bound in inconsistent ways
|
||||
//~^ ERROR is bound inconsistently
|
||||
_ => &5i32,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
||||
LL | Some((x, 3)) | &Some((ref x, 5)) => x,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue