Implement negative bounds

This commit is contained in:
Michael Goulet 2023-04-25 05:15:50 +00:00
parent 98c33e47a4
commit 6e01e910cb
33 changed files with 363 additions and 188 deletions

View file

@ -287,12 +287,20 @@ pub enum TraitBoundModifier {
/// No modifiers
None,
/// `!Trait`
Negative,
/// `?Trait`
Maybe,
/// `~const Trait`
MaybeConst,
/// `~const !Trait`
//
// This parses but will be rejected during AST validation.
MaybeConstNegative,
/// `~const ?Trait`
//
// This parses but will be rejected during AST validation.
@ -2446,6 +2454,16 @@ impl fmt::Debug for ImplPolarity {
}
}
#[derive(Copy, Clone, PartialEq, Encodable, Decodable, HashStable_Generic)]
pub enum BoundPolarity {
/// `Type: Trait`
Positive,
/// `Type: !Trait`
Negative(Span),
/// `Type: ?Trait`
Maybe(Span),
}
#[derive(Clone, Encodable, Decodable, Debug)]
pub enum FnRetTy {
/// Returns type is not specified.