Enforce that ? and for<...> are not combined
This commit is contained in:
parent
32c8bfdb11
commit
898ed2ffa6
6 changed files with 38 additions and 4 deletions
|
@ -994,6 +994,19 @@ impl<'a> Parser<'a> {
|
|||
let modifiers = self.parse_trait_bound_modifiers()?;
|
||||
let modifiers_span = modifiers_lo.to(self.prev_token.span);
|
||||
|
||||
if let Some(binder_span) = binder_span {
|
||||
match modifiers.polarity {
|
||||
BoundPolarity::Negative(polarity_span) | BoundPolarity::Maybe(polarity_span) => {
|
||||
self.dcx().emit_err(errors::BinderAndPolarity {
|
||||
binder_span,
|
||||
polarity_span,
|
||||
polarity: modifiers.polarity.as_str(),
|
||||
});
|
||||
}
|
||||
BoundPolarity::Positive => {}
|
||||
}
|
||||
}
|
||||
|
||||
// Recover erroneous lifetime bound with modifiers or binder.
|
||||
// e.g. `T: for<'a> 'a` or `T: ~const 'a`.
|
||||
if self.token.is_lifetime() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue