]> git.lizzy.rs Git - rust.git/commitdiff
Replace target.target with target
authorest31 <MTest31@outlook.com>
Wed, 14 Oct 2020 17:16:00 +0000 (19:16 +0200)
committerest31 <MTest31@outlook.com>
Thu, 15 Oct 2020 19:18:23 +0000 (21:18 +0200)
Rustc removed the target wrapper and exposed the target directly.

Result of running:

find . -type f -exec sed -i -e 's/target\.target\([)\.,;]\)/target\1/g' {} \;

Plus one manual edit of the rust-version file

13 files changed:
rust-version
src/helpers.rs
src/machine.rs
src/shims/env.rs
src/shims/foreign_items.rs
src/shims/os_str.rs
src/shims/posix/foreign_items.rs
src/shims/posix/fs.rs
src/shims/posix/linux/dlsym.rs
src/shims/posix/macos/dlsym.rs
src/shims/tls.rs
src/shims/windows/dlsym.rs
src/shims/windows/foreign_items.rs

index 6c876993b798ec97c0c6ebc3a3a6a5ad67755e75..e00bba68676644282766dca932d6f62f87cd76bf 100644 (file)
@@ -1 +1 @@
-06a079c43efb062e335e6e6c9dabd3c750619980
+b5c9e2448c9ace53ad5c11585803894651b18b0a
index 23bc54e76bb07284444dbcfe2d77fffddad9282c..a13d9b4519bd1773b4892a36cc8a75bdae4ac500 100644 (file)
@@ -387,7 +387,7 @@ fn check_no_isolation(&self, name: &str) -> InterpResult<'tcx> {
     /// if this is not the case.
     fn assert_target_os(&self, target_os: &str, name: &str) {
         assert_eq!(
-            self.eval_context_ref().tcx.sess.target.target.target_os,
+            self.eval_context_ref().tcx.sess.target.target_os,
             target_os,
             "`{}` is only available on the `{}` target OS",
             name,
@@ -430,7 +430,7 @@ fn get_last_error(&mut self) -> InterpResult<'tcx, Scalar<Tag>> {
     fn set_last_error_from_io_error(&mut self, e: std::io::Error) -> InterpResult<'tcx> {
         use std::io::ErrorKind::*;
         let this = self.eval_context_mut();
-        let target = &this.tcx.sess.target.target;
+        let target = &this.tcx.sess.target;
         let target_os = &target.target_os;
         let last_error = if target.options.target_family == Some("unix".to_owned()) {
             this.eval_libc(match e.kind() {
index 6defb2d053aa7a701d4da0fcee57136d7929a0eb..544f4667e84613e5a74aa3a6db5cd38f35994eaa 100644 (file)
@@ -173,7 +173,7 @@ fn add_extern_static<'tcx, 'mir>(
     pub fn init_extern_statics<'tcx, 'mir>(
         this: &mut MiriEvalContext<'mir, 'tcx>,
     ) -> InterpResult<'tcx> {
-        match this.tcx.sess.target.target.target_os.as_str() {
+        match this.tcx.sess.target.target_os.as_str() {
             "linux" => {
                 // "__cxa_thread_atexit_impl"
                 // This should be all-zero, pointer-sized.
index 42fd6e3dced8a38ca315a3d3b075bdd42419e904..2db64ad5a14c603fe37e183a27df4799a87e4c9a 100644 (file)
@@ -38,7 +38,7 @@ pub(crate) fn init<'mir>(
         ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
         mut excluded_env_vars: Vec<String>,
     ) -> InterpResult<'tcx> {
-        let target_os = ecx.tcx.sess.target.target.target_os.as_str();
+        let target_os = ecx.tcx.sess.target.target_os.as_str();
         if target_os == "windows" {
             // Temporary hack: Exclude `TERM` var to avoid terminfo trying to open the termcap file.
             // 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
 pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
     fn getenv(&mut self, name_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, Scalar<Tag>> {
         let this = self.eval_context_mut();
-        let target_os = &this.tcx.sess.target.target.target_os;
+        let target_os = &this.tcx.sess.target.target_os;
         assert!(target_os == "linux" || target_os == "macos", "`getenv` is only available for the UNIX target family");
 
         let name_ptr = this.read_scalar(name_op)?.check_init()?;
@@ -185,7 +185,7 @@ fn setenv(
         value_op: OpTy<'tcx, Tag>,
     ) -> InterpResult<'tcx, i32> {
         let mut this = self.eval_context_mut();
-        let target_os = &this.tcx.sess.target.target.target_os;
+        let target_os = &this.tcx.sess.target.target_os;
         assert!(target_os == "linux" || target_os == "macos", "`setenv` is only available for the UNIX target family");
 
         let name_ptr = this.read_scalar(name_op)?.check_init()?;
@@ -258,7 +258,7 @@ fn SetEnvironmentVariableW(
 
     fn unsetenv(&mut self, name_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, i32> {
         let this = self.eval_context_mut();
-        let target_os = &this.tcx.sess.target.target.target_os;
+        let target_os = &this.tcx.sess.target.target_os;
         assert!(target_os == "linux" || target_os == "macos", "`unsetenv` is only available for the UNIX target family");
 
         let name_ptr = this.read_scalar(name_op)?.check_init()?;
@@ -290,7 +290,7 @@ fn getcwd(
         size_op: OpTy<'tcx, Tag>,
     ) -> InterpResult<'tcx, Scalar<Tag>> {
         let this = self.eval_context_mut();
-        let target_os = &this.tcx.sess.target.target.target_os;
+        let target_os = &this.tcx.sess.target.target_os;
         assert!(target_os == "linux" || target_os == "macos", "`getcwd` is only available for the UNIX target family");
 
         this.check_no_isolation("`getcwd`")?;
@@ -336,7 +336,7 @@ fn GetCurrentDirectoryW(
 
     fn chdir(&mut self, path_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, i32> {
         let this = self.eval_context_mut();
-        let target_os = &this.tcx.sess.target.target.target_os;
+        let target_os = &this.tcx.sess.target.target_os;
         assert!(target_os == "linux" || target_os == "macos", "`getcwd` is only available for the UNIX target family");
 
         this.check_no_isolation("`chdir`")?;
index 7118fbda2403a21ef6c6cc564fbe93ae944dc5dd..cd6024444fa547ccfcffb3cca7d96b13ae7c2cd0 100644 (file)
@@ -19,7 +19,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
     fn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align {
         let this = self.eval_context_ref();
         // List taken from `libstd/sys_common/alloc.rs`.
-        let min_align = match this.tcx.sess.target.target.arch.as_str() {
+        let min_align = match this.tcx.sess.target.arch.as_str() {
             "x86" | "arm" | "mips" | "powerpc" | "powerpc64" | "asmjs" | "wasm32" => 8,
             "x86_64" | "aarch64" | "mips64" | "s390x" | "sparc64" => 16,
             arch => bug!("Unsupported target architecture: {}", arch),
@@ -480,13 +480,13 @@ fn emulate_foreign_item_by_name(
             }
 
             // Architecture-specific shims
-            "llvm.x86.sse2.pause" if this.tcx.sess.target.target.arch == "x86" || this.tcx.sess.target.target.arch == "x86_64" => {
+            "llvm.x86.sse2.pause" if this.tcx.sess.target.arch == "x86" || this.tcx.sess.target.arch == "x86_64" => {
                 let &[] = check_arg_count(args)?;
                 this.yield_active_thread();
             }
 
             // Platform-specific shims
-            _ => match this.tcx.sess.target.target.target_os.as_str() {
+            _ => match this.tcx.sess.target.target_os.as_str() {
                 "linux" | "macos" => return shims::posix::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret),
                 "windows" => return shims::windows::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret),
                 target => throw_unsup_format!("the target `{}` is not supported", target),
index 7635047064f12132bb244b02d7e0c55270c858ac..268b0902e9c2945c4f6af25518296db988d2a738 100644 (file)
@@ -234,7 +234,7 @@ fn convert_path_separator<'a>(
         direction: PathConversion,
     ) -> Cow<'a, OsStr> {
         let this = self.eval_context_ref();
-        let target_os = &this.tcx.sess.target.target.target_os;
+        let target_os = &this.tcx.sess.target.target_os;
         #[cfg(windows)]
         return if target_os == "windows" {
             // Windows-on-Windows, all fine.
index 177678f03d74cd482ca0ebc2b9e389cc6e9abf34..c527fa0d064a94d20c244190a8ffff74fe74fbbd 100644 (file)
@@ -165,7 +165,7 @@ fn emulate_foreign_item_by_name(
                 this.read_scalar(handle)?.to_machine_usize(this)?;
                 let symbol = this.read_scalar(symbol)?.check_init()?;
                 let symbol_name = this.memory.read_c_str(symbol)?;
-                if let Some(dlsym) = Dlsym::from_str(symbol_name, &this.tcx.sess.target.target.target_os)? {
+                if let Some(dlsym) = Dlsym::from_str(symbol_name, &this.tcx.sess.target.target_os)? {
                     let ptr = this.memory.create_fn_alloc(FnVal::Other(dlsym));
                     this.write_scalar(Scalar::from(ptr), dest)?;
                 } else {
@@ -452,7 +452,7 @@ fn emulate_foreign_item_by_name(
 
             // Platform-specific shims
             _ => {
-                match this.tcx.sess.target.target.target_os.as_str() {
+                match this.tcx.sess.target.target_os.as_str() {
                     "linux" => return shims::posix::linux::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret),
                     "macos" => return shims::posix::macos::foreign_items::EvalContextExt::emulate_foreign_item_by_name(this, link_name, args, dest, ret),
                     _ => unreachable!(),
index ebf7e16a153400226e35d99e13a92287b0691f63..a9d102912ab20a3f12c4c17381fc67184d204647 100644 (file)
@@ -555,7 +555,7 @@ fn fcntl(
                 },
                 None => return this.handle_not_found(),
             }
-        } else if this.tcx.sess.target.target.target_os == "macos"
+        } else if this.tcx.sess.target.target_os == "macos"
             && cmd == this.eval_libc_i32("F_FULLFSYNC")?
         {
             let &[_, _] = check_arg_count(args)?;
@@ -989,7 +989,7 @@ fn mkdir(
         this.check_no_isolation("`mkdir`")?;
 
         #[cfg_attr(not(unix), allow(unused_variables))]
-        let mode = if this.tcx.sess.target.target.target_os == "macos" {
+        let mode = if this.tcx.sess.target.target_os == "macos" {
             u32::from(this.read_scalar(mode_op)?.check_init()?.to_u16()?)
         } else {
             this.read_scalar(mode_op)?.to_u32()?
index 9be300edf495a74acf9b790123a9c1f669cc10ba..af5f5a20e445459145d21f078ec8e1948ae84062 100644 (file)
@@ -27,7 +27,7 @@ fn call_dlsym(
     ) -> InterpResult<'tcx> {
         let this = self.eval_context_mut();
         let (_dest, _ret) = ret.expect("we don't support any diverging dlsym");
-        assert!(this.tcx.sess.target.target.target_os == "linux");
+        assert!(this.tcx.sess.target.target_os == "linux");
 
         match dlsym {}
     }
index c9f57090ff8a244951a032f1ff2cc37e8f019ba0..82d8b16ad66ac07d1467efa134b3ea0a4bd31349 100644 (file)
@@ -32,7 +32,7 @@ fn call_dlsym(
     ) -> InterpResult<'tcx> {
         let this = self.eval_context_mut();
         let (dest, ret) = ret.expect("we don't support any diverging dlsym");
-        assert!(this.tcx.sess.target.target.target_os == "macos");
+        assert!(this.tcx.sess.target.target_os == "macos");
 
         match dlsym {
             Dlsym::getentropy => {
index 2ba0782f7054f74030259af1741a0c04dcfdc082..7b4d8fa56ae4f1650f5e274b6bcb53a4edd4a8c2 100644 (file)
@@ -340,7 +340,7 @@ fn schedule_next_tls_dtor_for_active_thread(&mut self) -> InterpResult<'tcx> {
             // This is the first time we got asked to schedule a destructor. The
             // Windows schedule destructor function must be called exactly once,
             // this is why it is in this block.
-            if this.tcx.sess.target.target.target_os == "windows" {
+            if this.tcx.sess.target.target_os == "windows" {
                 // On Windows, we signal that the thread quit by starting the
                 // relevant function, reenabling the thread, and going back to
                 // the scheduler.
index 91bfedff8db682870fe343c4120279f35613bf94..5454a00f14d5b7bdb606dec8610bfb1a1849b48d 100644 (file)
@@ -44,7 +44,7 @@ fn call_dlsym(
     ) -> InterpResult<'tcx> {
         let this = self.eval_context_mut();
         let (dest, ret) = ret.expect("we don't support any diverging dlsym");
-        assert!(this.tcx.sess.target.target.target_os == "windows");
+        assert!(this.tcx.sess.target.target_os == "windows");
 
         match dlsym {
             Dlsym::AcquireSRWLockExclusive => {
index fc1093b64fb4bfc971ae8a2d735307ea7bbed3db..d141fa57e13a4022053440f4d392e26487fd1a8f 100644 (file)
@@ -213,7 +213,7 @@ fn emulate_foreign_item_by_name(
                 let &[hModule, lpProcName] = check_arg_count(args)?;
                 this.read_scalar(hModule)?.to_machine_isize(this)?;
                 let name = this.memory.read_c_str(this.read_scalar(lpProcName)?.check_init()?)?;
-                if let Some(dlsym) = Dlsym::from_str(name, &this.tcx.sess.target.target.target_os)? {
+                if let Some(dlsym) = Dlsym::from_str(name, &this.tcx.sess.target.target_os)? {
                     let ptr = this.memory.create_fn_alloc(FnVal::Other(dlsym));
                     this.write_scalar(Scalar::from(ptr), dest)?;
                 } else {