From e9c34b3cf8f368077065e7f9a658038f36e196eb Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 8 Nov 2020 14:27:51 +0300 Subject: [PATCH] Collapse all uses of `target.options.foo` into `target.foo` with an eye on merging `TargetOptions` into `Target`. `TargetOptions` as a separate structure is mostly an implementation detail of `Target` construction, all its fields logically belong to `Target` and available from `Target` through `Deref` impls. --- src/archive.rs | 4 ++-- src/debuginfo/mod.rs | 2 +- src/driver/aot.rs | 4 ++-- src/metadata.rs | 2 +- src/toolchain.rs | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/archive.rs b/src/archive.rs index 9a970efbcfd..daf9fa6158f 100644 --- a/src/archive.rs +++ b/src/archive.rs @@ -63,9 +63,9 @@ fn new(sess: &'a Session, output: &Path, input: Option<&Path>) -> Self { sess, dst: output.to_path_buf(), lib_search_paths: archive_search_paths(sess), - use_gnu_style_archive: sess.target.options.archive_format == "gnu", + use_gnu_style_archive: sess.target.archive_format == "gnu", // FIXME fix builtin ranlib on macOS - no_builtin_ranlib: sess.target.options.is_like_osx, + no_builtin_ranlib: sess.target.is_like_osx, src_archives, entries, diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs index cbf9522b1d7..85e8158af27 100644 --- a/src/debuginfo/mod.rs +++ b/src/debuginfo/mod.rs @@ -50,7 +50,7 @@ pub(crate) fn new(tcx: TyCtxt<'tcx>, isa: &dyn TargetIsa) -> Self { // TODO: this should be configurable // macOS doesn't seem to support DWARF > 3 // 5 version is required for md5 file hash - version: if tcx.sess.target.options.is_like_osx { + version: if tcx.sess.target.is_like_osx { 3 } else { // FIXME change to version 5 once the gdb and lldb shipping with the latest debian diff --git a/src/driver/aot.rs b/src/driver/aot.rs index ff0b994c9a9..c0245aa1e02 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -320,8 +320,8 @@ fn codegen_global_asm(tcx: TyCtxt<'_>, cgu_name: &str, global_asm: &str) { } if cfg!(not(feature = "inline_asm")) - || tcx.sess.target.options.is_like_osx - || tcx.sess.target.options.is_like_windows + || tcx.sess.target.is_like_osx + || tcx.sess.target.is_like_windows { if global_asm.contains("__rust_probestack") { return; diff --git a/src/metadata.rs b/src/metadata.rs index cda2a187ff9..2e3b9fb8364 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -101,7 +101,7 @@ enum MetadataKind { product.add_rustc_section( rustc_middle::middle::exported_symbols::metadata_symbol_name(tcx), compressed, - tcx.sess.target.options.is_like_osx, + tcx.sess.target.is_like_osx, ); metadata diff --git a/src/toolchain.rs b/src/toolchain.rs index 463afaf7cc5..735c59d70c1 100644 --- a/src/toolchain.rs +++ b/src/toolchain.rs @@ -91,7 +91,7 @@ fn infer_from( } else if stem == "link" || stem == "lld-link" { LinkerFlavor::Msvc } else if stem == "lld" || stem == "rust-lld" { - LinkerFlavor::Lld(sess.target.options.lld_flavor) + LinkerFlavor::Lld(sess.target.lld_flavor) } else { // fall back to the value in the target spec sess.target.linker_flavor @@ -115,7 +115,7 @@ fn infer_from( if let Some(ret) = infer_from( sess, - sess.target.options.linker.clone().map(PathBuf::from), + sess.target.linker.clone().map(PathBuf::from), Some(sess.target.linker_flavor), ) { return ret;