Skip to content

Commit

Permalink
Rollup merge of rust-lang#78875 - petrochenkov:cleantarg, r=Mark-Simu…
Browse files Browse the repository at this point in the history
…lacrum

rustc_target: Further cleanup use of target options

Follow up to rust-lang#77729.

Implements items 2 and 4 from the list in rust-lang#77729 (comment).

The first commit collapses uses of `target.options.foo` into `target.foo`.

The second commit renames some target options to avoid tautology:
`target.target_endian` -> `target.endian`
`target.target_c_int_width` -> `target.c_int_width`
`target.target_os` -> `target.os`
`target.target_env` -> `target.env`
`target.target_vendor` -> `target.vendor`
`target.target_family` -> `target.os_family`
`target.target_mcount` -> `target.mcount`

r? `@Mark-Simulacrum`
  • Loading branch information
jonas-schievink committed Nov 10, 2020
2 parents 806538f + e9c34b3 commit 65ae469
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
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,
Expand Down
2 changes: 1 addition & 1 deletion src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl<'tcx> DebugContext<'tcx> {
// 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
Expand Down
4 changes: 2 additions & 2 deletions src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub(crate) fn write_metadata<P: WriteMetadata>(
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
Expand Down
4 changes: 2 additions & 2 deletions src/toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
} 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
Expand All @@ -115,7 +115,7 @@ fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {

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;
Expand Down

0 comments on commit 65ae469

Please sign in to comment.