From d683e3ac23a8f8b52cef07b4380845bbd1ef5e8f Mon Sep 17 00:00:00 2001 From: est31 Date: Wed, 14 Oct 2020 18:42:13 +0200 Subject: Remove rustc_session::config::Config The wrapper type led to tons of target.target across the compiler. Its ptr_width field isn't required any more, as target_pointer_width is already present in parsed form. --- compiler/rustc_session/src/config.rs | 11 ++--------- compiler/rustc_session/src/session.rs | 8 ++++---- 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'compiler/rustc_session/src') diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index fd7364b40be..f33bebf99d6 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -34,11 +34,6 @@ use std::iter::{self, FromIterator}; use std::path::{Path, PathBuf}; use std::str::{self, FromStr}; -pub struct Config { - pub target: Target, - pub ptr_width: u32, -} - bitflags! { #[derive(Default, Encodable, Decodable)] pub struct SanitizerSet: u8 { @@ -831,7 +826,7 @@ pub fn build_configuration(sess: &Session, mut user_cfg: CrateConfig) -> CrateCo user_cfg } -pub fn build_target_config(opts: &Options, target_override: Option) -> Config { +pub fn build_target_config(opts: &Options, target_override: Option) -> Target { let target_result = target_override.map_or_else(|| Target::search(&opts.target_triple), Ok); let target = target_result.unwrap_or_else(|e| { early_error( @@ -855,9 +850,7 @@ pub fn build_target_config(opts: &Options, target_override: Option) -> C ) } - let ptr_width = target.pointer_width; - - Config { target, ptr_width } + target } #[derive(Copy, Clone, PartialEq, Eq, Debug)] diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 867d6abcac2..8312f89b271 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -102,7 +102,7 @@ impl Mul for Limit { /// Represents the data associated with a compilation /// session for a single crate. pub struct Session { - pub target: config::Config, + pub target: Target, pub host: Target, pub opts: config::Options, pub host_tlib_path: SearchPath, @@ -1258,7 +1258,7 @@ pub fn build_session( let loader = file_loader.unwrap_or(Box::new(RealFileLoader)); let hash_kind = sopts.debugging_opts.src_hash_algorithm.unwrap_or_else(|| { - if target_cfg.target.options.is_like_msvc { + if target_cfg.options.is_like_msvc { SourceFileHashAlgorithm::Sha1 } else { SourceFileHashAlgorithm::Md5 @@ -1368,8 +1368,8 @@ pub fn build_session( if candidate.join("library/std/src/lib.rs").is_file() { Some(candidate) } else { None } }; - let asm_arch = if target_cfg.target.options.allow_asm { - InlineAsmArch::from_str(&target_cfg.target.arch).ok() + let asm_arch = if target_cfg.options.allow_asm { + InlineAsmArch::from_str(&target_cfg.arch).ok() } else { None }; -- cgit 1.4.1-3-g733a5