Consider negative polarity on overlap check
This commit is contained in:
parent
6975afd141
commit
8b0bfb0dcb
6 changed files with 46 additions and 19 deletions
|
@ -10,7 +10,7 @@ pub mod util;
|
|||
|
||||
use rustc_hir as hir;
|
||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||
use rustc_middle::ty::{self, Const, Ty};
|
||||
use rustc_middle::ty::{self, Const, Ty, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub use self::FulfillmentErrorCode::*;
|
||||
|
@ -55,6 +55,17 @@ pub struct Obligation<'tcx, T> {
|
|||
pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>;
|
||||
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
|
||||
|
||||
impl PredicateObligation<'tcx> {
|
||||
pub fn flip_polarity(&self, tcx: TyCtxt<'tcx>) -> Option<PredicateObligation<'tcx>> {
|
||||
Some(PredicateObligation {
|
||||
cause: self.cause.clone(),
|
||||
param_env: self.param_env,
|
||||
predicate: self.predicate.flip_polarity(tcx)?,
|
||||
recursion_depth: self.recursion_depth,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// `PredicateObligation` is used a lot. Make sure it doesn't unintentionally get bigger.
|
||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||
static_assert_size!(PredicateObligation<'_>, 32);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue