pub trait EvalContextExt<'tcx>: MiriInterpCxExt<'tcx> {
// Provided methods
fn last_error_place(&mut self) -> InterpResult<'tcx, MPlaceTy<'tcx>> { ... }
fn set_last_error(&mut self, err: impl Into<IoError>) -> InterpResult<'tcx> { ... }
fn set_last_error_and_return(
&mut self,
err: impl Into<IoError>,
dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx> { ... }
fn set_last_error_and_return_i32(
&mut self,
err: impl Into<IoError>,
) -> InterpResult<'tcx, Scalar> { ... }
fn set_last_error_and_return_i64(
&mut self,
err: impl Into<IoError>,
) -> InterpResult<'tcx, Scalar> { ... }
fn get_last_error(&mut self) -> InterpResult<'tcx, Scalar> { ... }
fn io_error_to_errnum(&self, err: Error) -> InterpResult<'tcx, Scalar> { ... }
fn try_errnum_to_io_error(
&self,
errnum: Scalar,
) -> InterpResult<'tcx, Option<ErrorKind>> { ... }
fn try_unwrap_io_result<T: From<i32>>(
&mut self,
result: Result<T>,
) -> InterpResult<'tcx, T> { ... }
}
Provided Methods§
Sourcefn last_error_place(&mut self) -> InterpResult<'tcx, MPlaceTy<'tcx>>
fn last_error_place(&mut self) -> InterpResult<'tcx, MPlaceTy<'tcx>>
Get last error variable as a place, lazily allocating thread-local storage for it if necessary.
Sourcefn set_last_error(&mut self, err: impl Into<IoError>) -> InterpResult<'tcx>
fn set_last_error(&mut self, err: impl Into<IoError>) -> InterpResult<'tcx>
Sets the last error variable.
Sourcefn set_last_error_and_return(
&mut self,
err: impl Into<IoError>,
dest: &MPlaceTy<'tcx>,
) -> InterpResult<'tcx>
fn set_last_error_and_return( &mut self, err: impl Into<IoError>, dest: &MPlaceTy<'tcx>, ) -> InterpResult<'tcx>
Sets the last OS error and writes -1 to dest place.
Sourcefn set_last_error_and_return_i32(
&mut self,
err: impl Into<IoError>,
) -> InterpResult<'tcx, Scalar>
fn set_last_error_and_return_i32( &mut self, err: impl Into<IoError>, ) -> InterpResult<'tcx, Scalar>
Sets the last OS error and return -1
as a i32
-typed Scalar
Sourcefn set_last_error_and_return_i64(
&mut self,
err: impl Into<IoError>,
) -> InterpResult<'tcx, Scalar>
fn set_last_error_and_return_i64( &mut self, err: impl Into<IoError>, ) -> InterpResult<'tcx, Scalar>
Sets the last OS error and return -1
as a i64
-typed Scalar
Sourcefn get_last_error(&mut self) -> InterpResult<'tcx, Scalar>
fn get_last_error(&mut self) -> InterpResult<'tcx, Scalar>
Gets the last error variable.
Sourcefn io_error_to_errnum(&self, err: Error) -> InterpResult<'tcx, Scalar>
fn io_error_to_errnum(&self, err: Error) -> InterpResult<'tcx, Scalar>
This function tries to produce the most similar OS error from the std::io::ErrorKind
as a platform-specific errnum.
Sourcefn try_errnum_to_io_error(
&self,
errnum: Scalar,
) -> InterpResult<'tcx, Option<ErrorKind>>
fn try_errnum_to_io_error( &self, errnum: Scalar, ) -> InterpResult<'tcx, Option<ErrorKind>>
The inverse of io_error_to_errnum
.
Sourcefn try_unwrap_io_result<T: From<i32>>(
&mut self,
result: Result<T>,
) -> InterpResult<'tcx, T>
fn try_unwrap_io_result<T: From<i32>>( &mut self, result: Result<T>, ) -> InterpResult<'tcx, T>
Helper function that consumes an std::io::Result<T>
and returns an
InterpResult<'tcx,T>::Ok
instead. In case the result is an error, this function returns
Ok(-1)
and sets the last OS error accordingly.
This function uses T: From<i32>
instead of i32
directly because some IO related
functions return different integer types (like read
, that returns an i64
).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.