pub struct InterpResult_<'tcx, T> {
res: Result<T, InterpErrorInfo<'tcx>>,
guard: Guard,
}
Expand description
The result type used by the interpreter. This is a newtype around Result
to block access to operations like ok()
that discard UB errors.
We also make things panic if this type is ever implicitly dropped.
Fields§
§res: Result<T, InterpErrorInfo<'tcx>>
§guard: Guard
Implementations§
source§impl<'tcx, T> InterpResult_<'tcx, T>
impl<'tcx, T> InterpResult_<'tcx, T>
fn new(res: Result<T, InterpErrorInfo<'tcx>>) -> Self
fn disarm(self) -> Result<T, InterpErrorInfo<'tcx>>
sourcepub fn discard_err(self) -> Option<T>
pub fn discard_err(self) -> Option<T>
Discard the error information in this result. Only use this if ignoring Undefined Behavior is okay!
sourcepub fn report_err(self) -> Result<T, InterpErrorInfo<'tcx>>
pub fn report_err(self) -> Result<T, InterpErrorInfo<'tcx>>
Look at the Result
wrapped inside of this.
Must only be used to report the error!
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> InterpResult<'tcx, U>
pub fn map_err_info( self, f: impl FnOnce(InterpErrorInfo<'tcx>) -> InterpErrorInfo<'tcx>, ) -> InterpResult<'tcx, T>
pub fn map_err_kind( self, f: impl FnOnce(InterpErrorKind<'tcx>) -> InterpErrorKind<'tcx>, ) -> InterpResult<'tcx, T>
pub fn inspect_err_kind( self, f: impl FnOnce(&InterpErrorKind<'tcx>), ) -> InterpResult<'tcx, T>
pub fn unwrap(self) -> T
pub fn unwrap_or_else(self, f: impl FnOnce(InterpErrorInfo<'tcx>) -> T) -> T
pub fn expect(self, msg: &str) -> T
pub fn and_then<U>( self, f: impl FnOnce(T) -> InterpResult<'tcx, U>, ) -> InterpResult<'tcx, U>
sourcepub fn and<U>(self, other: InterpResult<'tcx, U>) -> InterpResult<'tcx, (T, U)>
pub fn and<U>(self, other: InterpResult<'tcx, U>) -> InterpResult<'tcx, (T, U)>
Returns success if both self
and other
succeed, while ensuring we don’t
accidentally drop an error.
If both are an error, self
will be reported.
Trait Implementations§
source§impl<'tcx, T: Debug> Debug for InterpResult_<'tcx, T>
impl<'tcx, T: Debug> Debug for InterpResult_<'tcx, T>
source§impl<'tcx, T, V: FromIterator<T>> FromIterator<InterpResult_<'tcx, T>> for InterpResult<'tcx, V>
impl<'tcx, T, V: FromIterator<T>> FromIterator<InterpResult_<'tcx, T>> for InterpResult<'tcx, V>
source§fn from_iter<I: IntoIterator<Item = InterpResult<'tcx, T>>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = InterpResult<'tcx, T>>>(iter: I) -> Self
Creates a value from an iterator. Read more
source§impl<'tcx, T, E: Into<InterpErrorInfo<'tcx>>> FromResidual<Result<Infallible, E>> for InterpResult_<'tcx, T>
impl<'tcx, T, E: Into<InterpErrorInfo<'tcx>>> FromResidual<Result<Infallible, E>> for InterpResult_<'tcx, T>
source§fn from_residual(residual: Result<Infallible, E>) -> Self
fn from_residual(residual: Result<Infallible, E>) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from a compatible
Residual
type. Read moresource§impl<'tcx, T> FromResidual<Yeet<InterpErrorKind<'tcx>>> for InterpResult_<'tcx, T>
impl<'tcx, T> FromResidual<Yeet<InterpErrorKind<'tcx>>> for InterpResult_<'tcx, T>
source§fn from_residual(ops::Yeet: Yeet<InterpErrorKind<'tcx>>) -> Self
fn from_residual(ops::Yeet: Yeet<InterpErrorKind<'tcx>>) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from a compatible
Residual
type. Read moresource§impl<'tcx, T> FromResidual for InterpResult_<'tcx, T>
impl<'tcx, T> FromResidual for InterpResult_<'tcx, T>
source§fn from_residual(residual: InterpResult_<'tcx, Infallible>) -> Self
fn from_residual(residual: InterpResult_<'tcx, Infallible>) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from a compatible
Residual
type. Read moresource§impl<'tcx, T> Try for InterpResult_<'tcx, T>
impl<'tcx, T> Try for InterpResult_<'tcx, T>
source§type Output = T
type Output = T
🔬This is a nightly-only experimental API. (
try_trait_v2
)The type of the value produced by
?
when not short-circuiting.source§type Residual = InterpResult_<'tcx, Infallible>
type Residual = InterpResult_<'tcx, Infallible>
🔬This is a nightly-only experimental API. (
try_trait_v2
)The type of the value passed to
FromResidual::from_residual
as part of ?
when short-circuiting. Read moresource§fn from_output(output: Self::Output) -> Self
fn from_output(output: Self::Output) -> Self
🔬This is a nightly-only experimental API. (
try_trait_v2
)Constructs the type from its
Output
type. Read moresource§fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
fn branch(self) -> ControlFlow<Self::Residual, Self::Output>
🔬This is a nightly-only experimental API. (
try_trait_v2
)Used in
?
to decide whether the operator should produce a value
(because this returned ControlFlow::Continue
)
or propagate a value back to the caller
(because this returned ControlFlow::Break
). Read moreAuto Trait Implementations§
impl<'tcx, T> !DynSend for InterpResult_<'tcx, T>
impl<'tcx, T> !DynSync for InterpResult_<'tcx, T>
impl<'tcx, T> Freeze for InterpResult_<'tcx, T>where
T: Freeze,
impl<'tcx, T> !RefUnwindSafe for InterpResult_<'tcx, T>
impl<'tcx, T> !Send for InterpResult_<'tcx, T>
impl<'tcx, T> !Sync for InterpResult_<'tcx, T>
impl<'tcx, T> Unpin for InterpResult_<'tcx, T>where
T: Unpin,
impl<'tcx, T> !UnwindSafe for InterpResult_<'tcx, 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
source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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 moresource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error( tcx: Tcx, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.