miri::shims::io_error

Trait EvalContextExt

Source
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§

Source

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.

Source

fn set_last_error(&mut self, err: impl Into<IoError>) -> InterpResult<'tcx>

Sets the last error variable.

Source

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.

Source

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

Source

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

Source

fn get_last_error(&mut self) -> InterpResult<'tcx, Scalar>

Gets the last error variable.

Source

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.

Source

fn try_errnum_to_io_error( &self, errnum: Scalar, ) -> InterpResult<'tcx, Option<ErrorKind>>

The inverse of io_error_to_errnum.

Source

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.

Implementors§

Source§

impl<'tcx> EvalContextExt<'tcx> for MiriInterpCx<'tcx>