-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and tools
Description
(Follow up to #60635 and #60641)
When trying to match on the result of a fn
call, we emit:
error[E0164]: expected tuple struct/variant, found method `<A>::new`
--> src/lib.rs:15:9
|
15 | A::new() => (),
| ^^^^^^^^ not a tuple variant or struct
We should explain that fn
calls are not allowed ever in patterns, only refutable (or even irrefutable, as you can match on a struct, although it is silly) types, possibly linking to (or cribbing text from) the appropriate chapter in The Book.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and tools