-
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 lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Description
We should do better on the diagnostic in this case, since presumably the author of the code meant to return the 10, so we should suggest that the function needs a return type, somewhat as we currently give the "remove ;
" suggestion.
fn foo() {
10
}
error[E0308]: mismatched types
--> test.rs:2:5
|
2 | 10
| ^^ expected (), found integral variable
|
= note: expected type `()`
found type `{integer}`
error: aborting due to previous error
Filing this to close out #35478, #21838, #22216, #18595 as duplicates of this.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
estebank commentedon May 17, 2017
Previous stab at this: #39231.
estebank commentedon Jul 26, 2017
We do this now.
Point at return type always when type mismatch against it
Auto merge of #43484 - estebank:point-to-return, r=arielb1