pub struct InferOk<'db, T> {
pub value: T,
pub obligations: Vec<Obligation<'db, Predicate<'db>>>,
}
Expand description
InferOk<'tcx, ()>
is used a lot. It may seem like a useless wrapper
around PredicateObligations
, but it has one important property:
because InferOk
is marked with #[must_use]
, if you have a method
InferCtxt::f
that returns InferResult<()>
and you call it with
infcx.f()?;
you’ll get a warning about the obligations being discarded
without use, which is probably unintentional and has been a source of bugs
in the past.
Fields§
§value: T
§obligations: Vec<Obligation<'db, Predicate<'db>>>
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'db, T> Freeze for InferOk<'db, T>where
T: Freeze,
impl<'db, T> !RefUnwindSafe for InferOk<'db, T>
impl<'db, T> Send for InferOk<'db, T>where
T: Send,
impl<'db, T> Sync for InferOk<'db, T>where
T: Sync,
impl<'db, T> Unpin for InferOk<'db, T>where
T: Unpin,
impl<'db, T> !UnwindSafe for InferOk<'db, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more