about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser/mod.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-07-19 10:48:03 +0200
committerGitHub <noreply@github.com>2024-07-19 10:48:03 +0200
commitc86e13f330b8689d21bc258f50e96d36196733b3 (patch)
tree2bd26899afaf37abbf3c11e4377734183d3670f6 /compiler/rustc_parse/src/parser/mod.rs
parent3d68afc9e821b00d59058abc9bda670b07639955 (diff)
parent4cad705017f34a6545deb1505d0ce85537c18df5 (diff)
downloadrust-c86e13f330b8689d21bc258f50e96d36196733b3.tar.gz
rust-c86e13f330b8689d21bc258f50e96d36196733b3.zip
Rollup merge of #127350 - veera-sivarajan:bugfix-126311, r=lcnr
Parser: Suggest Placing the Return Type After Function Parameters

Fixes #126311

This PR suggests placing the return type after the function parameters when it's misplaced after a `where` clause.

This also tangentially improves diagnostics for cases like [this](https://github.com/veera-sivarajan/rust/blob/86d6f1312a77997ef994240e716288d61a343a6d/tests/ui/parser/issues/misplaced-return-type-without-where-issue-126311.rs#L1C1-L1C28) and adds doc comments for `parser::AllowPlus`.
Diffstat (limited to 'compiler/rustc_parse/src/parser/mod.rs')
-rw-r--r--compiler/rustc_parse/src/parser/mod.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs
index c03527acb2c..18da370dc2f 100644
--- a/compiler/rustc_parse/src/parser/mod.rs
+++ b/compiler/rustc_parse/src/parser/mod.rs
@@ -495,6 +495,7 @@ impl<'a> Parser<'a> {
             FatalError.raise();
         } else {
             self.expected_one_of_not_found(edible, inedible)
+                .map(|error_guaranteed| Recovered::Yes(error_guaranteed))
         }
     }