about summary refs log tree commit diff
path: root/compiler/rustc_ast
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-04-25 05:15:50 +0000
committerMichael Goulet <michael@errs.io>2023-05-02 22:36:24 +0000
commit6e01e910cb8ab0109235be7cc7ab7ef465724255 (patch)
treed63e7272022d540f0a93d43f36e359ff31c3f56d /compiler/rustc_ast
parent98c33e47a495fbd7b22bce9ce32f2815991bc414 (diff)
downloadrust-6e01e910cb8ab0109235be7cc7ab7ef465724255.tar.gz
rust-6e01e910cb8ab0109235be7cc7ab7ef465724255.zip
Implement negative bounds
Diffstat (limited to 'compiler/rustc_ast')
-rw-r--r--compiler/rustc_ast/src/ast.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index dce7106d128..b5dba0713bf 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -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.