Skip to content

Commit cc9aad4

Browse files
committed
resolve, inconsistent binding mode: tweak wording.
1 parent 4ad6248 commit cc9aad4

10 files changed

+74
-74
lines changed

Diff for: src/librustc_resolve/diagnostics.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ impl<'a> Resolver<'a> {
249249
self.session,
250250
span,
251251
E0409,
252-
"variable `{}` is bound in inconsistent \
253-
ways within the same match arm",
252+
"variable `{}` is bound inconsistently across alternatives separated by `|`",
254253
variable_name
255254
);
256255
err.span_label(span, "bound in different ways");

Diff for: src/test/ui/mismatched_types/E0409.stderr

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

Diff for: src/test/ui/or-patterns/inconsistent-modes.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
fn main() {
66
// One level:
77
let Ok(a) | Err(ref a): Result<&u8, u8> = Ok(&0);
8-
//~^ ERROR variable `a` is bound in inconsistent ways
8+
//~^ ERROR variable `a` is bound inconsistently
99
let Ok(ref mut a) | Err(a): Result<u8, &mut u8> = Ok(0);
10-
//~^ ERROR variable `a` is bound in inconsistent ways
10+
//~^ ERROR variable `a` is bound inconsistently
1111
let Ok(ref a) | Err(ref mut a): Result<&u8, &mut u8> = Ok(&0);
12-
//~^ ERROR variable `a` is bound in inconsistent ways
12+
//~^ ERROR variable `a` is bound inconsistently
1313
//~| ERROR mismatched types
1414
let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
15-
//~^ ERROR variable `a` is bound in inconsistent ways
16-
//~| ERROR variable `b` is bound in inconsistent ways
15+
//~^ ERROR variable `a` is bound inconsistently
16+
//~| ERROR variable `b` is bound inconsistently
1717
//~| ERROR mismatched types
1818

1919
// Two levels:
2020
let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0);
21-
//~^ ERROR variable `a` is bound in inconsistent ways
21+
//~^ ERROR variable `a` is bound inconsistently
2222

2323
// Three levels:
24-
let Ok([ Ok((Ok(ref a) | Err(a),)) | Err(a) ]) | Err(a) = Err(&1);
25-
//~^ ERROR variable `a` is bound in inconsistent ways
24+
let Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a) = Err(&1);
25+
//~^ ERROR variable `a` is bound inconsistently
2626
}

Diff for: src/test/ui/or-patterns/inconsistent-modes.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm
1+
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
22
--> $DIR/inconsistent-modes.rs:7:25
33
|
44
LL | let Ok(a) | Err(ref a): Result<&u8, u8> = Ok(&0);
55
| - ^ bound in different ways
66
| |
77
| first binding
88

9-
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm
9+
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
1010
--> $DIR/inconsistent-modes.rs:9:29
1111
|
1212
LL | let Ok(ref mut a) | Err(a): Result<u8, &mut u8> = Ok(0);
1313
| - ^ bound in different ways
1414
| |
1515
| first binding
1616

17-
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm
17+
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
1818
--> $DIR/inconsistent-modes.rs:11:33
1919
|
2020
LL | let Ok(ref a) | Err(ref mut a): Result<&u8, &mut u8> = Ok(&0);
2121
| - first binding ^ bound in different ways
2222

23-
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm
23+
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
2424
--> $DIR/inconsistent-modes.rs:14:39
2525
|
2626
LL | let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
2727
| - first binding ^ bound in different ways
2828

29-
error[E0409]: variable `b` is bound in inconsistent ways within the same match arm
29+
error[E0409]: variable `b` is bound inconsistently across alternatives separated by `|`
3030
--> $DIR/inconsistent-modes.rs:14:46
3131
|
3232
LL | let Ok((ref a, b)) | Err((ref mut a, ref b)) = Ok((0, &0));
3333
| - first binding ^ bound in different ways
3434

35-
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm
35+
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
3636
--> $DIR/inconsistent-modes.rs:20:38
3737
|
3838
LL | let Ok(Ok(a) | Err(a)) | Err(ref a) = Err(0);
3939
| - ^ bound in different ways
4040
| |
4141
| first binding
4242

43-
error[E0409]: variable `a` is bound in inconsistent ways within the same match arm
44-
--> $DIR/inconsistent-modes.rs:24:34
43+
error[E0409]: variable `a` is bound inconsistently across alternatives separated by `|`
44+
--> $DIR/inconsistent-modes.rs:24:33
4545
|
46-
LL | let Ok([ Ok((Ok(ref a) | Err(a),)) | Err(a) ]) | Err(a) = Err(&1);
47-
| - ^ bound in different ways
48-
| |
49-
| first binding
46+
LL | let Ok([Ok((Ok(ref a) | Err(a),)) | Err(a)]) | Err(a) = Err(&1);
47+
| - ^ bound in different ways
48+
| |
49+
| first binding
5050

5151
error[E0308]: mismatched types
5252
--> $DIR/inconsistent-modes.rs:11:25

Diff for: src/test/ui/resolve/resolve-inconsistent-binding-mode.rs

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,40 @@
11
enum Opts {
2-
A(isize), B(isize), C(isize)
2+
A(isize),
3+
B(isize),
4+
C(isize),
35
}
46

57
fn matcher1(x: Opts) {
68
match x {
7-
Opts::A(ref i) | Opts::B(i) => {}
8-
//~^ ERROR variable `i` is bound in inconsistent ways within the same match arm
9-
//~^^ ERROR mismatched types
10-
Opts::C(_) => {}
9+
Opts::A(ref i) | Opts::B(i) => {}
10+
//~^ ERROR variable `i` is bound inconsistently
11+
//~^^ ERROR mismatched types
12+
Opts::C(_) => {}
1113
}
1214
}
1315

1416
fn matcher2(x: Opts) {
1517
match x {
16-
Opts::A(ref i) | Opts::B(i) => {}
17-
//~^ ERROR variable `i` is bound in inconsistent ways within the same match arm
18-
//~^^ ERROR mismatched types
19-
Opts::C(_) => {}
18+
Opts::A(ref i) | Opts::B(i) => {}
19+
//~^ ERROR variable `i` is bound inconsistently
20+
//~^^ ERROR mismatched types
21+
Opts::C(_) => {}
2022
}
2123
}
2224

2325
fn matcher4(x: Opts) {
2426
match x {
25-
Opts::A(ref mut i) | Opts::B(ref i) => {}
26-
//~^ ERROR variable `i` is bound in inconsistent ways within the same match arm
27-
//~^^ ERROR mismatched types
28-
Opts::C(_) => {}
27+
Opts::A(ref mut i) | Opts::B(ref i) => {}
28+
//~^ ERROR variable `i` is bound inconsistently
29+
//~^^ ERROR mismatched types
30+
Opts::C(_) => {}
2931
}
3032
}
3133

32-
3334
fn matcher5(x: Opts) {
3435
match x {
35-
Opts::A(ref i) | Opts::B(ref i) => {}
36-
Opts::C(_) => {}
36+
Opts::A(ref i) | Opts::B(ref i) => {}
37+
Opts::C(_) => {}
3738
}
3839
}
3940

Diff for: src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,58 @@
1-
error[E0409]: variable `i` is bound in inconsistent ways within the same match arm
2-
--> $DIR/resolve-inconsistent-binding-mode.rs:7:32
1+
error[E0409]: variable `i` is bound inconsistently across alternatives separated by `|`
2+
--> $DIR/resolve-inconsistent-binding-mode.rs:9:34
33
|
4-
LL | Opts::A(ref i) | Opts::B(i) => {}
5-
| - ^ bound in different ways
6-
| |
7-
| first binding
4+
LL | Opts::A(ref i) | Opts::B(i) => {}
5+
| - ^ bound in different ways
6+
| |
7+
| first binding
88

9-
error[E0409]: variable `i` is bound in inconsistent ways within the same match arm
10-
--> $DIR/resolve-inconsistent-binding-mode.rs:16:32
9+
error[E0409]: variable `i` is bound inconsistently across alternatives separated by `|`
10+
--> $DIR/resolve-inconsistent-binding-mode.rs:18:34
1111
|
12-
LL | Opts::A(ref i) | Opts::B(i) => {}
13-
| - ^ bound in different ways
14-
| |
15-
| first binding
12+
LL | Opts::A(ref i) | Opts::B(i) => {}
13+
| - ^ bound in different ways
14+
| |
15+
| first binding
1616

17-
error[E0409]: variable `i` is bound in inconsistent ways within the same match arm
18-
--> $DIR/resolve-inconsistent-binding-mode.rs:25:40
17+
error[E0409]: variable `i` is bound inconsistently across alternatives separated by `|`
18+
--> $DIR/resolve-inconsistent-binding-mode.rs:27:42
1919
|
20-
LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
21-
| - first binding ^ bound in different ways
20+
LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
21+
| - first binding ^ bound in different ways
2222

2323
error[E0308]: mismatched types
24-
--> $DIR/resolve-inconsistent-binding-mode.rs:7:32
24+
--> $DIR/resolve-inconsistent-binding-mode.rs:9:34
2525
|
2626
LL | match x {
2727
| - this expression has type `Opts`
28-
LL | Opts::A(ref i) | Opts::B(i) => {}
29-
| ----- ^ expected `&isize`, found `isize`
30-
| |
31-
| first introduced with type `&isize` here
28+
LL | Opts::A(ref i) | Opts::B(i) => {}
29+
| ----- ^ expected `&isize`, found `isize`
30+
| |
31+
| first introduced with type `&isize` here
3232
|
3333
= note: in the same arm, a binding must have the same type in all alternatives
3434

3535
error[E0308]: mismatched types
36-
--> $DIR/resolve-inconsistent-binding-mode.rs:16:32
36+
--> $DIR/resolve-inconsistent-binding-mode.rs:18:34
3737
|
3838
LL | match x {
3939
| - this expression has type `Opts`
40-
LL | Opts::A(ref i) | Opts::B(i) => {}
41-
| ----- ^ expected `&isize`, found `isize`
42-
| |
43-
| first introduced with type `&isize` here
40+
LL | Opts::A(ref i) | Opts::B(i) => {}
41+
| ----- ^ expected `&isize`, found `isize`
42+
| |
43+
| first introduced with type `&isize` here
4444
|
4545
= note: in the same arm, a binding must have the same type in all alternatives
4646

4747
error[E0308]: mismatched types
48-
--> $DIR/resolve-inconsistent-binding-mode.rs:25:36
48+
--> $DIR/resolve-inconsistent-binding-mode.rs:27:38
4949
|
5050
LL | match x {
5151
| - this expression has type `Opts`
52-
LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
53-
| --------- ^^^^^ types differ in mutability
54-
| |
55-
| first introduced with type `&mut isize` here
52+
LL | Opts::A(ref mut i) | Opts::B(ref i) => {}
53+
| --------- ^^^^^ types differ in mutability
54+
| |
55+
| first introduced with type `&mut isize` here
5656
|
5757
= note: expected type `&mut isize`
5858
found type `&isize`

Diff for: src/test/ui/resolve/resolve-inconsistent-names.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() {
1919
(A, B) | (ref B, c) | (c, A) => ()
2020
//~^ ERROR variable `A` is not bound in all patterns
2121
//~| ERROR variable `B` is not bound in all patterns
22-
//~| ERROR variable `B` is bound in inconsistent ways
22+
//~| ERROR variable `B` is bound inconsistently
2323
//~| ERROR mismatched types
2424
//~| ERROR variable `c` is not bound in all patterns
2525
//~| HELP consider making the path in the pattern qualified: `?::A`

Diff for: src/test/ui/resolve/resolve-inconsistent-names.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ LL | (A, B) | (ref B, c) | (c, A) => ()
4747
| | variable not in all patterns
4848
| pattern doesn't bind `c`
4949

50-
error[E0409]: variable `B` is bound in inconsistent ways within the same match arm
50+
error[E0409]: variable `B` is bound inconsistently across alternatives separated by `|`
5151
--> $DIR/resolve-inconsistent-names.rs:19:23
5252
|
5353
LL | (A, B) | (ref B, c) | (c, A) => ()

Diff for: src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub fn main() {
44
let x = &Some((3, 3));
55
let _: &i32 = match x {
66
Some((x, 3)) | &Some((ref x, 5)) => x,
7-
//~^ ERROR is bound in inconsistent ways
7+
//~^ ERROR is bound inconsistently
88
_ => &5i32,
99
};
1010
}

Diff for: src/test/ui/rfc-2005-default-binding-mode/issue-44912-or.stderr

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

0 commit comments

Comments
 (0)