mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 06:28:20 +03:00
helpers.rs cleanup
This commit is contained in:
+8
-8
@@ -359,11 +359,11 @@ fn write_packed_immediates(
|
||||
/// Helper function used inside the shims of foreign functions to check that isolation is
|
||||
/// disabled. It returns an error using the `name` of the foreign function if this is not the
|
||||
/// case.
|
||||
fn check_no_isolation(&mut self, name: &str) -> InterpResult<'tcx> {
|
||||
if !self.eval_context_mut().machine.communicate {
|
||||
fn check_no_isolation(&self, name: &str) -> InterpResult<'tcx> {
|
||||
if !self.eval_context_ref().machine.communicate {
|
||||
throw_unsup_format!(
|
||||
"`{}` not available when isolation is enabled. Pass the flag `-Zmiri-disable-isolation` to disable it.",
|
||||
name
|
||||
name,
|
||||
)
|
||||
}
|
||||
Ok(())
|
||||
@@ -371,13 +371,13 @@ fn check_no_isolation(&mut self, name: &str) -> InterpResult<'tcx> {
|
||||
/// Helper function used inside the shims of foreign functions to assert that the target
|
||||
/// platform is `platform`. It panics showing a message with the `name` of the foreign function
|
||||
/// if this is not the case.
|
||||
fn assert_platform(&mut self, platform: &str, name: &str) {
|
||||
fn assert_platform(&self, platform: &str, name: &str) {
|
||||
assert_eq!(
|
||||
self.eval_context_mut().tcx.sess.target.target.target_os.to_lowercase(),
|
||||
self.eval_context_ref().tcx.sess.target.target.target_os.to_lowercase(),
|
||||
platform,
|
||||
"`{}` is only available on the `{}` platform",
|
||||
name,
|
||||
platform
|
||||
platform,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -389,8 +389,8 @@ fn set_last_error(&mut self, scalar: Scalar<Tag>) -> InterpResult<'tcx> {
|
||||
}
|
||||
|
||||
/// Gets the last error variable.
|
||||
fn get_last_error(&mut self) -> InterpResult<'tcx, Scalar<Tag>> {
|
||||
let this = self.eval_context_mut();
|
||||
fn get_last_error(&self) -> InterpResult<'tcx, Scalar<Tag>> {
|
||||
let this = self.eval_context_ref();
|
||||
let errno_place = this.machine.last_error.unwrap();
|
||||
this.read_scalar(errno_place.into())?.not_undef()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user