Skip to content

Commit 1b3a27c

Browse files
committed
Auto merge of #1583 - est31:target_refactor, r=RalfJung
Replace target.target with target Fix fallout caused by rustc PR: rust-lang/rust#77943 Fixes rust-lang/rust#77988
2 parents 8beccc4 + 1ae157b commit 1b3a27c

13 files changed

+23
-23
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
06a079c43efb062e335e6e6c9dabd3c750619980
1+
b5c9e2448c9ace53ad5c11585803894651b18b0a

src/helpers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
387387
/// if this is not the case.
388388
fn assert_target_os(&self, target_os: &str, name: &str) {
389389
assert_eq!(
390-
self.eval_context_ref().tcx.sess.target.target.target_os,
390+
self.eval_context_ref().tcx.sess.target.target_os,
391391
target_os,
392392
"`{}` is only available on the `{}` target OS",
393393
name,
@@ -430,7 +430,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
430430
fn set_last_error_from_io_error(&mut self, e: std::io::Error) -> InterpResult<'tcx> {
431431
use std::io::ErrorKind::*;
432432
let this = self.eval_context_mut();
433-
let target = &this.tcx.sess.target.target;
433+
let target = &this.tcx.sess.target;
434434
let target_os = &target.target_os;
435435
let last_error = if target.options.target_family == Some("unix".to_owned()) {
436436
this.eval_libc(match e.kind() {

src/machine.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ impl MemoryExtra {
173173
pub fn init_extern_statics<'tcx, 'mir>(
174174
this: &mut MiriEvalContext<'mir, 'tcx>,
175175
) -> InterpResult<'tcx> {
176-
match this.tcx.sess.target.target.target_os.as_str() {
176+
match this.tcx.sess.target.target_os.as_str() {
177177
"linux" => {
178178
// "__cxa_thread_atexit_impl"
179179
// This should be all-zero, pointer-sized.

src/shims/env.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl<'tcx> EnvVars<'tcx> {
3838
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
3939
mut excluded_env_vars: Vec<String>,
4040
) -> InterpResult<'tcx> {
41-
let target_os = ecx.tcx.sess.target.target.target_os.as_str();
41+
let target_os = ecx.tcx.sess.target.target_os.as_str();
4242
if target_os == "windows" {
4343
// Temporary hack: Exclude `TERM` var to avoid terminfo trying to open the termcap file.
4444
// Can be removed once https://github.com/rust-lang/miri/issues/1013 is resolved.
@@ -101,7 +101,7 @@ impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mi
101101
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
102102
fn getenv(&mut self, name_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, Scalar<Tag>> {
103103
let this = self.eval_context_mut();
104-
let target_os = &this.tcx.sess.target.target.target_os;
104+
let target_os = &this.tcx.sess.target.target_os;
105105
assert!(target_os == "linux" || target_os == "macos", "`getenv` is only available for the UNIX target family");
106106

107107
let name_ptr = this.read_scalar(name_op)?.check_init()?;
@@ -185,7 +185,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
185185
value_op: OpTy<'tcx, Tag>,
186186
) -> InterpResult<'tcx, i32> {
187187
let mut this = self.eval_context_mut();
188-
let target_os = &this.tcx.sess.target.target.target_os;
188+
let target_os = &this.tcx.sess.target.target_os;
189189
assert!(target_os == "linux" || target_os == "macos", "`setenv` is only available for the UNIX target family");
190190

191191
let name_ptr = this.read_scalar(name_op)?.check_init()?;
@@ -258,7 +258,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
258258

259259
fn unsetenv(&mut self, name_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, i32> {
260260
let this = self.eval_context_mut();
261-
let target_os = &this.tcx.sess.target.target.target_os;
261+
let target_os = &this.tcx.sess.target.target_os;
262262
assert!(target_os == "linux" || target_os == "macos", "`unsetenv` is only available for the UNIX target family");
263263

264264
let name_ptr = this.read_scalar(name_op)?.check_init()?;
@@ -290,7 +290,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
290290
size_op: OpTy<'tcx, Tag>,
291291
) -> InterpResult<'tcx, Scalar<Tag>> {
292292
let this = self.eval_context_mut();
293-
let target_os = &this.tcx.sess.target.target.target_os;
293+
let target_os = &this.tcx.sess.target.target_os;
294294
assert!(target_os == "linux" || target_os == "macos", "`getcwd` is only available for the UNIX target family");
295295

296296
this.check_no_isolation("`getcwd`")?;
@@ -336,7 +336,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
336336

337337
fn chdir(&mut self, path_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, i32> {
338338
let this = self.eval_context_mut();
339-
let target_os = &this.tcx.sess.target.target.target_os;
339+
let target_os = &this.tcx.sess.target.target_os;
340340
assert!(target_os == "linux" || target_os == "macos", "`getcwd` is only available for the UNIX target family");
341341

342342
this.check_no_isolation("`chdir`")?;

src/shims/foreign_items.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1919
fn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align {
2020
let this = self.eval_context_ref();
2121
// List taken from `libstd/sys_common/alloc.rs`.
22-
let min_align = match this.tcx.sess.target.target.arch.as_str() {
22+
let min_align = match this.tcx.sess.target.arch.as_str() {
2323
"x86" | "arm" | "mips" | "powerpc" | "powerpc64" | "asmjs" | "wasm32" => 8,
2424
"x86_64" | "aarch64" | "mips64" | "s390x" | "sparc64" => 16,
2525
arch => bug!("Unsupported target architecture: {}", arch),
@@ -480,13 +480,13 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
480480
}
481481

482482
// Architecture-specific shims
483-
"llvm.x86.sse2.pause" if this.tcx.sess.target.target.arch == "x86" || this.tcx.sess.target.target.arch == "x86_64" => {
483+
"llvm.x86.sse2.pause" if this.tcx.sess.target.arch == "x86" || this.tcx.sess.target.arch == "x86_64" => {
484484
let &[] = check_arg_count(args)?;
485485
this.yield_active_thread();
486486
}
487487

488488
// Platform-specific shims
489-
_ => match this.tcx.sess.target.target.target_os.as_str() {
489+
_ => match this.tcx.sess.target.target_os.as_str() {
490490
"linux" | "macos" => return shims::posix::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret),
491491
"windows" => return shims::windows::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret),
492492
target => throw_unsup_format!("the target `{}` is not supported", target),

src/shims/os_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
234234
direction: PathConversion,
235235
) -> Cow<'a, OsStr> {
236236
let this = self.eval_context_ref();
237-
let target_os = &this.tcx.sess.target.target.target_os;
237+
let target_os = &this.tcx.sess.target.target_os;
238238
#[cfg(windows)]
239239
return if target_os == "windows" {
240240
// Windows-on-Windows, all fine.

src/shims/posix/foreign_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
165165
this.read_scalar(handle)?.to_machine_usize(this)?;
166166
let symbol = this.read_scalar(symbol)?.check_init()?;
167167
let symbol_name = this.memory.read_c_str(symbol)?;
168-
if let Some(dlsym) = Dlsym::from_str(symbol_name, &this.tcx.sess.target.target.target_os)? {
168+
if let Some(dlsym) = Dlsym::from_str(symbol_name, &this.tcx.sess.target.target_os)? {
169169
let ptr = this.memory.create_fn_alloc(FnVal::Other(dlsym));
170170
this.write_scalar(Scalar::from(ptr), dest)?;
171171
} else {
@@ -452,7 +452,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
452452

453453
// Platform-specific shims
454454
_ => {
455-
match this.tcx.sess.target.target.target_os.as_str() {
455+
match this.tcx.sess.target.target_os.as_str() {
456456
"linux" => return shims::posix::linux::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret),
457457
"macos" => return shims::posix::macos::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret),
458458
_ => unreachable!(),

src/shims/posix/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
555555
},
556556
None => return this.handle_not_found(),
557557
}
558-
} else if this.tcx.sess.target.target.target_os == "macos"
558+
} else if this.tcx.sess.target.target_os == "macos"
559559
&& cmd == this.eval_libc_i32("F_FULLFSYNC")?
560560
{
561561
let &[_, _] = check_arg_count(args)?;
@@ -989,7 +989,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
989989
this.check_no_isolation("`mkdir`")?;
990990

991991
#[cfg_attr(not(unix), allow(unused_variables))]
992-
let mode = if this.tcx.sess.target.target.target_os == "macos" {
992+
let mode = if this.tcx.sess.target.target_os == "macos" {
993993
u32::from(this.read_scalar(mode_op)?.check_init()?.to_u16()?)
994994
} else {
995995
this.read_scalar(mode_op)?.to_u32()?

src/shims/posix/linux/dlsym.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
2727
) -> InterpResult<'tcx> {
2828
let this = self.eval_context_mut();
2929
let (_dest, _ret) = ret.expect("we don't support any diverging dlsym");
30-
assert!(this.tcx.sess.target.target.target_os == "linux");
30+
assert!(this.tcx.sess.target.target_os == "linux");
3131

3232
match dlsym {}
3333
}

src/shims/posix/macos/dlsym.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
3232
) -> InterpResult<'tcx> {
3333
let this = self.eval_context_mut();
3434
let (dest, ret) = ret.expect("we don't support any diverging dlsym");
35-
assert!(this.tcx.sess.target.target.target_os == "macos");
35+
assert!(this.tcx.sess.target.target_os == "macos");
3636

3737
match dlsym {
3838
Dlsym::getentropy => {

src/shims/tls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
340340
// This is the first time we got asked to schedule a destructor. The
341341
// Windows schedule destructor function must be called exactly once,
342342
// this is why it is in this block.
343-
if this.tcx.sess.target.target.target_os == "windows" {
343+
if this.tcx.sess.target.target_os == "windows" {
344344
// On Windows, we signal that the thread quit by starting the
345345
// relevant function, reenabling the thread, and going back to
346346
// the scheduler.

src/shims/windows/dlsym.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
4444
) -> InterpResult<'tcx> {
4545
let this = self.eval_context_mut();
4646
let (dest, ret) = ret.expect("we don't support any diverging dlsym");
47-
assert!(this.tcx.sess.target.target.target_os == "windows");
47+
assert!(this.tcx.sess.target.target_os == "windows");
4848

4949
match dlsym {
5050
Dlsym::AcquireSRWLockExclusive => {

src/shims/windows/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
213213
let &[hModule, lpProcName] = check_arg_count(args)?;
214214
this.read_scalar(hModule)?.to_machine_isize(this)?;
215215
let name = this.memory.read_c_str(this.read_scalar(lpProcName)?.check_init()?)?;
216-
if let Some(dlsym) = Dlsym::from_str(name, &this.tcx.sess.target.target.target_os)? {
216+
if let Some(dlsym) = Dlsym::from_str(name, &this.tcx.sess.target.target_os)? {
217217
let ptr = this.memory.create_fn_alloc(FnVal::Other(dlsym));
218218
this.write_scalar(Scalar::from(ptr), dest)?;
219219
} else {

0 commit comments

Comments
 (0)