Document flip polarity
This commit is contained in:
parent
7829d9dde3
commit
c4c76a4fbd
2 changed files with 7 additions and 0 deletions
|
@ -56,6 +56,9 @@ pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>;
|
|||
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
|
||||
|
||||
impl PredicateObligation<'tcx> {
|
||||
/// Flips the polarity of the inner predicate.
|
||||
///
|
||||
/// Given `T: Trait` predicate it returns `T: !Trait` and given `T: !Trait` returns `T: Trait`.
|
||||
pub fn flip_polarity(&self, tcx: TyCtxt<'tcx>) -> Option<PredicateObligation<'tcx>> {
|
||||
Some(PredicateObligation {
|
||||
cause: self.cause.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue