diff --git a/src/eval.rs b/src/eval.rs index 898e1ff6e4b..de6c9fac1d5 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -190,7 +190,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>( /// Returns `Some(return_code)` if program executed completed. /// Returns `None` if an evaluation error occured. pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) -> Option { - // FIXME: We always ignore leaks on some platforms where we do not + // FIXME: We always ignore leaks on some OSs where we do not // correctly implement TLS destructors. let target_os = tcx.sess.target.target.target_os.as_str(); let ignore_leaks = config.ignore_leaks || target_os == "windows" || target_os == "macos"; diff --git a/src/helpers.rs b/src/helpers.rs index 169bb420564..36d3181ce4e 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -374,16 +374,16 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx } Ok(()) } - /// 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 + /// Helper function used inside the shims of foreign functions to assert that the target OS + /// is `target_os`. It panics showing a message with the `name` of the foreign function /// if this is not the case. - fn assert_platform(&self, platform: &str, name: &str) { + fn assert_target_os(&self, target_os: &str, name: &str) { assert_eq!( self.eval_context_ref().tcx.sess.target.target.target_os, - platform, - "`{}` is only available on the `{}` platform", + target_os, + "`{}` is only available on the `{}` target OS", name, - platform, + target_os, ) } diff --git a/src/machine.rs b/src/machine.rs index 3cf00781338..693c80f7dea 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -126,7 +126,7 @@ impl MemoryExtra { .insert(Symbol::intern("environ"), this.machine.env_vars.environ.unwrap().ptr.assert_ptr().alloc_id) .unwrap_none(); } - _ => {} // No "extern statics" supported on this platform + _ => {} // No "extern statics" supported on this target } Ok(()) } diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 60da1f1e6cc..6827b72427f 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -437,7 +437,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx _ => match this.tcx.sess.target.target.target_os.as_str() { "linux" | "macos" => return posix::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret), "windows" => return windows::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret), - target => throw_unsup_format!("the {} target platform is not supported", target), + target => throw_unsup_format!("the target `{}` is not supported", target), } }; diff --git a/src/shims/fs.rs b/src/shims/fs.rs index a5aae5ed90c..d799d8ed9a8 100644 --- a/src/shims/fs.rs +++ b/src/shims/fs.rs @@ -66,9 +66,9 @@ impl FileHandler { impl<'mir, 'tcx> EvalContextExtPrivate<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} trait EvalContextExtPrivate<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { - /// Emulate `stat` or `lstat` on the `macos` platform. This function is not intended to be + /// Emulate `stat` or `lstat` on `macos`. This function is not intended to be /// called directly from `emulate_foreign_item_by_name`, so it does not check if isolation is - /// disabled or if the target platform is the correct one. Please use `macos_stat` or + /// disabled or if the target OS is the correct one. Please use `macos_stat` or /// `macos_lstat` instead. fn macos_stat_or_lstat( &mut self, @@ -114,7 +114,7 @@ trait EvalContextExtPrivate<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, ' let blksize_t_layout = this.libc_ty_layout("blksize_t")?; let uint32_t_layout = this.libc_ty_layout("uint32_t")?; - // We need to add 32 bits of padding after `st_rdev` if we are on a 64-bit platform. + // We need to add 32 bits of padding after `st_rdev` if we are on a 64-bit target. let pad_layout = if this.tcx.sess.target.ptr_width == 64 { uint32_t_layout } else { @@ -258,10 +258,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx let o_wronly = this.eval_libc_i32("O_WRONLY")?; let o_rdwr = this.eval_libc_i32("O_RDWR")?; // The first two bits of the flag correspond to the access mode in linux, macOS and - // windows. We need to check that in fact the access mode flags for the current platform - // only use these two bits, otherwise we are in an unsupported platform and should error. + // windows. We need to check that in fact the access mode flags for the current target + // only use these two bits, otherwise we are in an unsupported target and should error. if (o_rdonly | o_wronly | o_rdwr) & !0b11 != 0 { - throw_unsup_format!("access mode flags on this platform are unsupported"); + throw_unsup_format!("access mode flags on this target are unsupported"); } let mut writable = true; @@ -574,7 +574,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx buf_op: OpTy<'tcx, Tag>, ) -> InterpResult<'tcx, i32> { let this = self.eval_context_mut(); - this.assert_platform("macos", "stat"); + this.assert_target_os("macos", "stat"); this.check_no_isolation("stat")?; // `stat` always follows symlinks. this.macos_stat_or_lstat(true, path_op, buf_op) @@ -587,7 +587,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx buf_op: OpTy<'tcx, Tag>, ) -> InterpResult<'tcx, i32> { let this = self.eval_context_mut(); - this.assert_platform("macos", "lstat"); + this.assert_target_os("macos", "lstat"); this.check_no_isolation("lstat")?; this.macos_stat_or_lstat(false, path_op, buf_op) } @@ -599,7 +599,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx ) -> InterpResult<'tcx, i32> { let this = self.eval_context_mut(); - this.assert_platform("macos", "fstat"); + this.assert_target_os("macos", "fstat"); this.check_no_isolation("fstat")?; let fd = this.read_scalar(fd_op)?.to_i32()?; @@ -621,7 +621,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx ) -> InterpResult<'tcx, i32> { let this = self.eval_context_mut(); - this.assert_platform("linux", "statx"); + this.assert_target_os("linux", "statx"); this.check_no_isolation("statx")?; let statxbuf_scalar = this.read_scalar(statxbuf_op)?.not_undef()?; @@ -685,7 +685,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx // the `_mask_op` paramter specifies the file information that the caller requested. // However `statx` is allowed to return information that was not requested or to not // return information that was requested. This `mask` represents the information we can - // actually provide in any host platform. + // actually provide for any target. let mut mask = this.eval_libc("STATX_TYPE")?.to_u32()? | this.eval_libc("STATX_SIZE")?.to_u32()?; @@ -880,7 +880,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx ) -> InterpResult<'tcx, i32> { let this = self.eval_context_mut(); - this.assert_platform("linux", "readdir64_r"); + this.assert_target_os("linux", "readdir64_r"); this.check_no_isolation("readdir64_r")?; let dirp = this.read_scalar(dirp_op)?.to_machine_usize(this)?; @@ -967,7 +967,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx ) -> InterpResult<'tcx, i32> { let this = self.eval_context_mut(); - this.assert_platform("macos", "readdir_r"); + this.assert_target_os("macos", "readdir_r"); this.check_no_isolation("readdir_r")?; let dirp = this.read_scalar(dirp_op)?.to_machine_usize(this)?; diff --git a/src/shims/panic.rs b/src/shims/panic.rs index 8dded8bf403..703e711972a 100644 --- a/src/shims/panic.rs +++ b/src/shims/panic.rs @@ -32,11 +32,11 @@ pub struct CatchUnwindData<'tcx> { impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { - /// Check if panicking is supported on this platform, and give a good error otherwise. + /// Check if panicking is supported on this target, and give a good error otherwise. fn check_panic_supported(&self) -> InterpResult<'tcx> { match self.eval_context_ref().tcx.sess.target.target.target_os.as_str() { "linux" | "macos" => Ok(()), - _ => throw_unsup_format!("panicking is not supported on this platform"), + _ => throw_unsup_format!("panicking is not supported on this target"), } } diff --git a/src/shims/time.rs b/src/shims/time.rs index b270c9770f8..58db60e5168 100644 --- a/src/shims/time.rs +++ b/src/shims/time.rs @@ -20,7 +20,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx ) -> InterpResult<'tcx, i32> { let this = self.eval_context_mut(); - this.assert_platform("linux", "clock_gettime"); + this.assert_target_os("linux", "clock_gettime"); this.check_no_isolation("clock_gettime")?; let clk_id = this.read_scalar(clk_id_op)?.to_i32()?; @@ -58,7 +58,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx ) -> InterpResult<'tcx, i32> { let this = self.eval_context_mut(); - this.assert_platform("macos", "gettimeofday"); + this.assert_target_os("macos", "gettimeofday"); this.check_no_isolation("gettimeofday")?; // Using tz is obsolete and should always be null @@ -88,7 +88,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx fn mach_absolute_time(&self) -> InterpResult<'tcx, u64> { let this = self.eval_context_ref(); - this.assert_platform("macos", "mach_absolute_time"); + this.assert_target_os("macos", "mach_absolute_time"); this.check_no_isolation("mach_absolute_time")?; // This returns a u64, with time units determined dynamically by `mach_timebase_info`. diff --git a/test-cargo-miri/tests/test.rs b/test-cargo-miri/tests/test.rs index 0095802a59a..68d5426802b 100644 --- a/test-cargo-miri/tests/test.rs +++ b/test-cargo-miri/tests/test.rs @@ -45,7 +45,7 @@ fn num_cpus() { // FIXME: Remove this `cfg` once we fix https://github.com/rust-lang/miri/issues/1059. // We cfg-gate the `should_panic` attribute and the `panic!` itself, so that the test -// stdout does not depend on the platform. +// stdout does not depend on the target. #[test] #[cfg_attr(not(windows), should_panic(expected="Explicit panic"))] fn do_panic() { // In large, friendly letters :) diff --git a/tests/compile-fail/panic/windows1.rs b/tests/compile-fail/panic/windows1.rs index 1d6faf1e751..142ba85c42c 100644 --- a/tests/compile-fail/panic/windows1.rs +++ b/tests/compile-fail/panic/windows1.rs @@ -3,7 +3,7 @@ // Test that panics on Windows give a reasonable error message. -// error-pattern: panicking is not supported on this platform +// error-pattern: panicking is not supported on this target fn main() { core::panic!("this is {}", "Windows"); } diff --git a/tests/compile-fail/panic/windows2.rs b/tests/compile-fail/panic/windows2.rs index 023088a692e..da2cfb59362 100644 --- a/tests/compile-fail/panic/windows2.rs +++ b/tests/compile-fail/panic/windows2.rs @@ -3,7 +3,7 @@ // Test that panics on Windows give a reasonable error message. -// error-pattern: panicking is not supported on this platform +// error-pattern: panicking is not supported on this target fn main() { std::panic!("this is Windows"); } diff --git a/tests/compile-fail/panic/windows3.rs b/tests/compile-fail/panic/windows3.rs index b96022fc4ef..a2e7bf5a7d4 100644 --- a/tests/compile-fail/panic/windows3.rs +++ b/tests/compile-fail/panic/windows3.rs @@ -3,7 +3,7 @@ // Test that panics on Windows give a reasonable error message. -// error-pattern: panicking is not supported on this platform +// error-pattern: panicking is not supported on this target #[allow(unconditional_panic)] fn main() { let _val = 1/0; diff --git a/tests/run-pass/bitop-beyond-alignment.rs b/tests/run-pass/bitop-beyond-alignment.rs index a30f0fb6131..02031130b8d 100644 --- a/tests/run-pass/bitop-beyond-alignment.rs +++ b/tests/run-pass/bitop-beyond-alignment.rs @@ -33,5 +33,5 @@ fn is_u64_aligned(u: &Tag) -> bool { pub fn main() { let x = mk_rec(); - is_u64_aligned(&x.t); // the result of this is non-deterministic (even with a fixed seed, results vary between platforms) + is_u64_aligned(&x.t); // the result of this is non-deterministic (even with a fixed seed, results vary between targets) } diff --git a/tests/run-pass/memchr.rs b/tests/run-pass/memchr.rs index 2f5e2c4bb73..e92c37ff2a8 100644 --- a/tests/run-pass/memchr.rs +++ b/tests/run-pass/memchr.rs @@ -2,7 +2,7 @@ use core::slice::memchr::{memchr, memrchr}; -// test fallback implementations on all platforms +// test fallback implementations on all targets fn matches_one() { assert_eq!(Some(0), memchr(b'a', b"a")); }