about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSantiago Pastorino <spastorino@gmail.com>2022-03-17 11:10:19 -0300
committerSantiago Pastorino <spastorino@gmail.com>2022-03-17 11:10:19 -0300
commit78346489c66779d024c60af2d2f0f5d9d455f688 (patch)
treea0fc5b00a15fe345b0c67d3396a8ef5ea36733d5
parentc3797dcce68a0b8b51028f2b9c797d300bac94c1 (diff)
downloadrust-78346489c66779d024c60af2d2f0f5d9d455f688.tar.gz
rust-78346489c66779d024c60af2d2f0f5d9d455f688.zip
Add comments on Polarity
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index e7cef9e198b..83ab761aa55 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -748,6 +748,13 @@ pub struct TraitPredicate<'tcx> {
 
     pub constness: BoundConstness,
 
+    /// If polarity is Positive: we are proving that the trait is implemented.
+    ///
+    /// If polarity is Negative: we are proving that a negative impl of this trait
+    /// exists. (Note that coherence also checks whether negative impls of supertraits
+    /// exist via a series of predicates.)
+    ///
+    /// If polarity is Reserved: that's a bug.
     pub polarity: ImplPolarity,
 }