diff options
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/diagnostics.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index eeedfd157be..744ec7e6114 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -640,6 +640,15 @@ impl<'a> Parser<'a> { appl, ); } + + if ["def", "fun", "func", "function"].contains(&symbol.as_str()) { + err.span_suggestion_short( + self.prev_token.span, + &format!("write `fn` instead of `{symbol}` to declare a function"), + "fn", + appl, + ); + } } // Add suggestion for a missing closing angle bracket if '>' is included in expected_tokens |
