Obligation::as_goal
This commit is contained in:
parent
aa8f0fd716
commit
575f129faa
7 changed files with 17 additions and 18 deletions
|
@ -246,8 +246,7 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||
.eq(DefineOpaqueTypes::Yes, prev, hidden_ty)?
|
||||
.obligations
|
||||
.into_iter()
|
||||
// FIXME: Shuttling between obligations and goals is awkward.
|
||||
.map(Goal::from),
|
||||
.map(|obligation| obligation.as_goal()),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,12 @@ pub struct Obligation<'tcx, T> {
|
|||
pub recursion_depth: usize,
|
||||
}
|
||||
|
||||
impl<'tcx, T: Copy> Obligation<'tcx, T> {
|
||||
pub fn as_goal(&self) -> solve::Goal<'tcx, T> {
|
||||
solve::Goal { param_env: self.param_env, predicate: self.predicate }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx, T: PartialEq> PartialEq<Obligation<'tcx, T>> for Obligation<'tcx, T> {
|
||||
#[inline]
|
||||
fn eq(&self, other: &Obligation<'tcx, T>) -> bool {
|
||||
|
@ -75,12 +81,6 @@ impl<T: Hash> Hash for Obligation<'_, T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx, P> From<Obligation<'tcx, P>> for solve::Goal<'tcx, P> {
|
||||
fn from(value: Obligation<'tcx, P>) -> Self {
|
||||
solve::Goal { param_env: value.param_env, predicate: value.predicate }
|
||||
}
|
||||
}
|
||||
|
||||
pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>;
|
||||
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::TraitPredicate<'tcx>>;
|
||||
pub type PolyTraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue