Rollup merge of #110791 - compiler-errors:negative-bounds, r=oli-obk
Implement negative bounds for internal testing purposes Implements partial support the `!` negative polarity on trait bounds. This is incomplete, but should allow us to at least be able to play with the feature. Not even gonna consider them as a public-facing feature, but I'm implementing them because would've been nice to have in UI tests, for example in #110671.
This commit is contained in:
commit
80df4ab403
42 changed files with 481 additions and 188 deletions
|
@ -788,11 +788,7 @@ impl<'a> Parser<'a> {
|
|||
// Parse optional colon and supertrait bounds.
|
||||
let had_colon = self.eat(&token::Colon);
|
||||
let span_at_colon = self.prev_token.span;
|
||||
let bounds = if had_colon {
|
||||
self.parse_generic_bounds(Some(self.prev_token.span))?
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
let bounds = if had_colon { self.parse_generic_bounds()? } else { Vec::new() };
|
||||
|
||||
let span_before_eq = self.prev_token.span;
|
||||
if self.eat(&token::Eq) {
|
||||
|
@ -802,7 +798,7 @@ impl<'a> Parser<'a> {
|
|||
self.sess.emit_err(errors::BoundsNotAllowedOnTraitAliases { span });
|
||||
}
|
||||
|
||||
let bounds = self.parse_generic_bounds(None)?;
|
||||
let bounds = self.parse_generic_bounds()?;
|
||||
generics.where_clause = self.parse_where_clause()?;
|
||||
self.expect_semi()?;
|
||||
|
||||
|
@ -883,7 +879,7 @@ impl<'a> Parser<'a> {
|
|||
|
||||
// Parse optional colon and param bounds.
|
||||
let bounds =
|
||||
if self.eat(&token::Colon) { self.parse_generic_bounds(None)? } else { Vec::new() };
|
||||
if self.eat(&token::Colon) { self.parse_generic_bounds()? } else { Vec::new() };
|
||||
let before_where_clause = self.parse_where_clause()?;
|
||||
|
||||
let ty = if self.eat(&token::Eq) { Some(self.parse_ty()?) } else { None };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue