Rollup merge of #127103 - compiler-errors:tighten-trait-bound-parsing, r=fmease

Move binder and polarity parsing into `parse_generic_ty_bound`

Let's pull out the parts of #127054 which just:
1. Make the parsing code less confusing
2. Fix `?use<>` (to correctly be denied)
3. Improve `T: for<'a> 'a` diagnostics

This should have no user-facing effects on stable parsing.

r? fmease
This commit is contained in:
Matthias Krüger 2024-06-29 09:14:59 +02:00 committed by GitHub
commit a4e92bfef0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 204 additions and 40 deletions

View file

@ -2327,7 +2327,7 @@ impl<'a> Parser<'a> {
let before = self.prev_token.clone();
let binder = if self.check_keyword(kw::For) {
let lo = self.token.span;
let lifetime_defs = self.parse_late_bound_lifetime_defs()?;
let (lifetime_defs, _) = self.parse_late_bound_lifetime_defs()?;
let span = lo.to(self.prev_token.span);
self.psess.gated_spans.gate(sym::closure_lifetime_binder, span);