Rollup merge of #107813 - compiler-errors:bad-impl-trait-in-macro-is-ok, r=estebank
Do not eagerly recover for bad `impl Trait` types in macros Fixes #107796 cc #106712, ```@estebank``` and ```@Ezrashaw``` please make sure to use [`Parser::may_recover`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.may_recover) for all eager-token-consuming parser recoveries. This also fixes a separate regression from #99915, that was introduced before we added `may_recover` though.
This commit is contained in:
commit
ab09405e99
3 changed files with 35 additions and 2 deletions
|
@ -694,8 +694,9 @@ impl<'a> Parser<'a> {
|
|||
// `where`, so stop if it's it.
|
||||
// We also continue if we find types (not traits), again for error recovery.
|
||||
while self.can_begin_bound()
|
||||
|| self.token.can_begin_type()
|
||||
|| (self.token.is_reserved_ident() && !self.token.is_keyword(kw::Where))
|
||||
|| (self.may_recover()
|
||||
&& (self.token.can_begin_type()
|
||||
|| (self.token.is_reserved_ident() && !self.token.is_keyword(kw::Where))))
|
||||
{
|
||||
if self.token.is_keyword(kw::Dyn) {
|
||||
// Account for `&dyn Trait + dyn Other`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue