Skip to content

Adding suggestion for E0530 #99008

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update ui test for the new E0530 suggestion
  • Loading branch information
obeis committed Jul 8, 2022
commit 1b32eb34b36db37902afcaefd49a8da6167cbd30
3 changes: 1 addition & 2 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -926,8 +926,7 @@ impl<'a> Resolver<'a> {
"try specify the pattern arguments",
format!("{}(..)", name),
Applicability::Unspecified,
)
.emit();
);
}
_ => (),
}
Expand Down
10 changes: 8 additions & 2 deletions src/test/ui/empty/empty-struct-tuple-pat.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ LL | struct Empty2();
| ---------------- the tuple struct `Empty2` is defined here
...
LL | Empty2 => ()
| ^^^^^^ cannot be named the same as a tuple struct
| ^^^^^^
| |
| cannot be named the same as a tuple struct
| help: try specify the pattern arguments: `Empty2(..)`

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

error[E0532]: expected unit struct, unit variant or constant, found tuple variant `E::Empty4`
--> $DIR/empty-struct-tuple-pat.rs:29:9
Expand Down
5 changes: 4 additions & 1 deletion src/test/ui/pattern/pat-tuple-field-count-cross.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ LL | use declarations_for_tuple_field_count_errors::*;
| -------------------------------------------- the tuple struct `Z1` is imported here
...
LL | Z1 => {}
| ^^ cannot be named the same as a tuple struct
| ^^
| |
| cannot be named the same as a tuple struct
| help: try specify the pattern arguments: `Z1(..)`

error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0`
--> $DIR/pat-tuple-field-count-cross.rs:9:9
Expand Down
5 changes: 4 additions & 1 deletion src/test/ui/pattern/pat-tuple-overfield.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ LL | struct Z1();
| ------------ the tuple struct `Z1` is defined here
...
LL | Z1 => {}
| ^^ cannot be named the same as a tuple struct
| ^^
| |
| cannot be named the same as a tuple struct
| help: try specify the pattern arguments: `Z1(..)`

error[E0532]: expected tuple struct or tuple variant, found unit struct `Z0`
--> $DIR/pat-tuple-overfield.rs:52:9
Expand Down
10 changes: 8 additions & 2 deletions src/test/ui/pattern/pattern-binding-disambiguation.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ LL | struct TupleStruct();
| --------------------- the tuple struct `TupleStruct` is defined here
...
LL | TupleStruct => {}
| ^^^^^^^^^^^ cannot be named the same as a tuple struct
| ^^^^^^^^^^^
| |
| cannot be named the same as a tuple struct
| help: try specify the pattern arguments: `TupleStruct(..)`

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

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