Skip to content

Suggest fn if fun, func, function or def is used instead #99751

@Rageking8

Description

@Rageking8

Given the following code:

func foo() -> i32 { 123 } function foo() -> i32 { 123 }

The current output is:

 Compiling playground v0.0.1 (/playground) error: expected one of `!` or `::`, found `foo` --> src/main.rs:1:6 | 1 | func foo() -> i32 { | ^^^ expected one of `!` or `::` error: could not compile `playground` due to previous error 

Ideally the error message should suggest replacing func or function with fn.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions