1
Fork 0

rustc_target: Rename 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`
This commit is contained in:
Vadim Petrochenkov 2020-11-08 14:57:55 +03:00
parent bf66988aa1
commit dc004d4809
114 changed files with 218 additions and 243 deletions

View file

@ -163,7 +163,7 @@ fn get_linker(
// MSVC needs to link with the Store versions of the runtime libraries (vcruntime, msvcrt, etc).
let t = &sess.target;
if (flavor == LinkerFlavor::Msvc || flavor == LinkerFlavor::Lld(LldFlavor::Link))
&& t.target_vendor == "uwp"
&& t.vendor == "uwp"
{
if let Some(ref tool) = msvc_tool {
let original_path = tool.path();
@ -1236,7 +1236,7 @@ fn crt_objects_fallback(sess: &Session, crate_type: CrateType) -> bool {
Some(CrtObjectsFallback::Musl) => sess.crt_static(Some(crate_type)),
Some(CrtObjectsFallback::Mingw) => {
sess.host == sess.target
&& sess.target.target_vendor != "uwp"
&& sess.target.vendor != "uwp"
&& detect_self_contained_mingw(&sess)
}
// FIXME: Figure out cases in which WASM needs to link with a native toolchain.
@ -1510,7 +1510,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
let base_cmd = get_linker(sess, path, flavor, crt_objects_fallback);
// FIXME: Move `/LIBPATH` addition for uwp targets from the linker construction
// to the linker args construction.
assert!(base_cmd.get_args().is_empty() || sess.target.target_vendor == "uwp");
assert!(base_cmd.get_args().is_empty() || sess.target.vendor == "uwp");
let cmd = &mut *codegen_results.linker_info.to_linker(base_cmd, &sess, flavor, target_cpu);
let link_output_kind = link_output_kind(sess, crate_type);
@ -2078,9 +2078,9 @@ fn are_upstream_rust_objects_already_included(sess: &Session) -> bool {
fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
let arch = &sess.target.arch;
let os = &sess.target.target_os;
let os = &sess.target.os;
let llvm_target = &sess.target.llvm_target;
if sess.target.target_vendor != "apple"
if sess.target.vendor != "apple"
|| !matches!(os.as_str(), "ios" | "tvos")
|| flavor != LinkerFlavor::Gcc
{

View file

@ -320,7 +320,7 @@ impl<'a> Linker for GccLinker<'a> {
// any `#[link]` attributes in the `libc` crate, see #72782 for details.
// FIXME: Switch to using `#[link]` attributes in the `libc` crate
// similarly to other targets.
if self.sess.target.target_os == "vxworks"
if self.sess.target.os == "vxworks"
&& matches!(
output_kind,
LinkOutputKind::StaticNoPicExe

View file

@ -51,11 +51,11 @@ pub trait DerivedTypeMethods<'tcx>: BaseTypeMethods<'tcx> + MiscMethods<'tcx> {
}
fn type_int(&self) -> Self::Type {
match &self.sess().target.target_c_int_width[..] {
match &self.sess().target.c_int_width[..] {
"16" => self.type_i16(),
"32" => self.type_i32(),
"64" => self.type_i64(),
width => bug!("Unsupported target_c_int_width: {}", width),
width => bug!("Unsupported c_int_width: {}", width),
}
}