Skip to content

Commit 1b32eb3

Browse files
committed
Update ui test for the new E0530 suggestion
1 parent c2436d5 commit 1b32eb3

5 files changed

+25
-8
lines changed

compiler/rustc_resolve/src/diagnostics.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -926,8 +926,7 @@ impl<'a> Resolver<'a> {
926926
"try specify the pattern arguments",
927927
format!("{}(..)", name),
928928
Applicability::Unspecified,
929-
)
930-
.emit();
929+
);
931930
}
932931
_ => (),
933932
}

src/test/ui/empty/empty-struct-tuple-pat.stderr

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ LL | struct Empty2();
55
| ---------------- the tuple struct `Empty2` is defined here
66
...
77
LL | Empty2 => ()
8-
| ^^^^^^ cannot be named the same as a tuple struct
8+
| ^^^^^^
9+
| |
10+
| cannot be named the same as a tuple struct
11+
| help: try specify the pattern arguments: `Empty2(..)`
912

1013
error[E0530]: match bindings cannot shadow tuple structs
1114
--> $DIR/empty-struct-tuple-pat.rs:25:9
@@ -14,7 +17,10 @@ LL | use empty_struct::*;
1417
| --------------- the tuple struct `XEmpty6` is imported here
1518
...
1619
LL | XEmpty6 => ()
17-
| ^^^^^^^ cannot be named the same as a tuple struct
20+
| ^^^^^^^
21+
| |
22+
| cannot be named the same as a tuple struct
23+
| help: try specify the pattern arguments: `XEmpty6(..)`
1824

1925
error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E::Empty4`
2026
--> $DIR/empty-struct-tuple-pat.rs:29:9

src/test/ui/pattern/pat-tuple-field-count-cross.stderr

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ LL | use declarations_for_tuple_field_count_errors::*;
55
| -------------------------------------------- the tuple struct `Z1` is imported here
66
...
77
LL | Z1 => {}
8-
| ^^ cannot be named the same as a tuple struct
8+
| ^^
9+
| |
10+
| cannot be named the same as a tuple struct
11+
| help: try specify the pattern arguments: `Z1(..)`
912

1013
error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0`
1114
--> $DIR/pat-tuple-field-count-cross.rs:9:9

src/test/ui/pattern/pat-tuple-overfield.stderr

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ LL | struct Z1();
55
| ------------ the tuple struct `Z1` is defined here
66
...
77
LL | Z1 => {}
8-
| ^^ cannot be named the same as a tuple struct
8+
| ^^
9+
| |
10+
| cannot be named the same as a tuple struct
11+
| help: try specify the pattern arguments: `Z1(..)`
912

1013
error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0`
1114
--> $DIR/pat-tuple-overfield.rs:52:9

src/test/ui/pattern/pattern-binding-disambiguation.stderr

+8-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ LL | struct TupleStruct();
55
| --------------------- the tuple struct `TupleStruct` is defined here
66
...
77
LL | TupleStruct => {}
8-
| ^^^^^^^^^^^ cannot be named the same as a tuple struct
8+
| ^^^^^^^^^^^
9+
| |
10+
| cannot be named the same as a tuple struct
11+
| help: try specify the pattern arguments: `TupleStruct(..)`
912

1013
error[E0530]: match bindings cannot shadow tuple variants
1114
--> $DIR/pattern-binding-disambiguation.rs:33:9
@@ -14,7 +17,10 @@ LL | use E::*;
1417
| ---- the tuple variant `TupleVariant` is imported here
1518
...
1619
LL | TupleVariant => {}
17-
| ^^^^^^^^^^^^ cannot be named the same as a tuple variant
20+
| ^^^^^^^^^^^^
21+
| |
22+
| cannot be named the same as a tuple variant
23+
| help: try specify the pattern arguments: `TupleVariant(..)`
1824

1925
error[E0530]: match bindings cannot shadow struct variants
2026
--> $DIR/pattern-binding-disambiguation.rs:36:9

0 commit comments

Comments
 (0)