Adds diagnostic message and UI test.
This commit is contained in:
committed by
Vadim Petrochenkov
parent
88f755f8a8
commit
00887f39d1
@@ -6716,8 +6716,16 @@ impl<'a> Parser<'a> {
|
||||
ast::ImplPolarity::Positive
|
||||
};
|
||||
|
||||
let possible_missing_trait = self.look_ahead(0, |t| t.is_keyword(keywords::For));
|
||||
|
||||
// Parse both types and traits as a type, then reinterpret if necessary.
|
||||
let ty_first = self.parse_ty()?;
|
||||
let ty_first = self.parse_ty().map_err(|mut err| {
|
||||
if possible_missing_trait {
|
||||
err.help("did you forget a trait name after `impl`?");
|
||||
}
|
||||
|
||||
err
|
||||
})?;
|
||||
|
||||
// If `for` is missing we try to recover.
|
||||
let has_for = self.eat_keyword(keywords::For);
|
||||
|
||||
Reference in New Issue
Block a user