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](86d6f1312a/tests/ui/parser/issues/misplaced-return-type-without-where-issue-126311.rs (L1C1-L1C28)
) and adds doc comments for `parser::AllowPlus`.
This commit is contained in:
commit
c86e13f330
16 changed files with 215 additions and 39 deletions
|
@ -21,6 +21,11 @@ use rustc_span::symbol::{kw, sym, Ident};
|
|||
use rustc_span::{ErrorGuaranteed, Span, Symbol};
|
||||
use thin_vec::{thin_vec, ThinVec};
|
||||
|
||||
/// Signals whether parsing a type should allow `+`.
|
||||
///
|
||||
/// For example, let T be the type `impl Default + 'static`
|
||||
/// With `AllowPlus::Yes`, T will be parsed successfully
|
||||
/// With `AllowPlus::No`, parsing T will return a parse error
|
||||
#[derive(Copy, Clone, PartialEq)]
|
||||
pub(super) enum AllowPlus {
|
||||
Yes,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue