Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 7834648

Browse files
committed
Add comments on Polarity
1 parent c3797dc commit 7834648

File tree

1 file changed

+7
-0
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+7
-0
lines changed

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,13 @@ pub struct TraitPredicate<'tcx> {
748748

749749
pub constness: BoundConstness,
750750

751+
/// If polarity is Positive: we are proving that the trait is implemented.
752+
///
753+
/// If polarity is Negative: we are proving that a negative impl of this trait
754+
/// exists. (Note that coherence also checks whether negative impls of supertraits
755+
/// exist via a series of predicates.)
756+
///
757+
/// If polarity is Reserved: that's a bug.
751758
pub polarity: ImplPolarity,
752759
}
753760

0 commit comments

Comments
 (0)