Avoid qualified path recovery when not followed by identifier
This commit is contained in:
parent
991d2ee282
commit
07ee472cd1
1 changed files with 5 additions and 1 deletions
|
@ -82,13 +82,17 @@ impl<'a> Parser<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Recover from an invalid single colon, when the user likely meant a qualified path.
|
/// Recover from an invalid single colon, when the user likely meant a qualified path.
|
||||||
|
/// We avoid emitting this if not followed by an identifier, as our assumption that the user
|
||||||
|
/// intended this to be a qualified path may not be correct.
|
||||||
///
|
///
|
||||||
/// ```ignore (diagnostics)
|
/// ```ignore (diagnostics)
|
||||||
/// <Bar as Baz<T>>:Qux
|
/// <Bar as Baz<T>>:Qux
|
||||||
/// ^ help: use double colon
|
/// ^ help: use double colon
|
||||||
/// ```
|
/// ```
|
||||||
fn recover_colon_before_qpath_proj(&mut self) -> bool {
|
fn recover_colon_before_qpath_proj(&mut self) -> bool {
|
||||||
if self.token.kind != token::Colon {
|
if self.token.kind != token::Colon
|
||||||
|
|| self.look_ahead(1, |t| !t.is_ident() || t.is_reserved_ident())
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue