diff options
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 92 | ||||
| -rw-r--r-- | compiler/rustc_session/src/options.rs | 9 | ||||
| -rw-r--r-- | compiler/rustc_session/src/session.rs | 104 |
3 files changed, 104 insertions, 101 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index b7da0f22942..0e52bf34661 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -722,7 +722,7 @@ impl Default for Options { target_triple: TargetTriple::from_triple(host_triple()), test: false, incremental: None, - debugging_opts: Default::default(), + unstable_opts: Default::default(), prints: Vec::new(), cg: Default::default(), error_format: ErrorOutputType::default(), @@ -752,8 +752,8 @@ impl Options { /// Returns `true` if there is a reason to build the dep graph. pub fn build_dep_graph(&self) -> bool { self.incremental.is_some() - || self.debugging_opts.dump_dep_graph - || self.debugging_opts.query_dep_graph + || self.unstable_opts.dump_dep_graph + || self.unstable_opts.query_dep_graph } pub fn file_path_mapping(&self) -> FilePathMapping { @@ -762,13 +762,13 @@ impl Options { /// Returns `true` if there will be an output file generated. pub fn will_create_output_file(&self) -> bool { - !self.debugging_opts.parse_only && // The file is just being parsed - !self.debugging_opts.ls // The file is just being queried + !self.unstable_opts.parse_only && // The file is just being parsed + !self.unstable_opts.ls // The file is just being queried } #[inline] pub fn share_generics(&self) -> bool { - match self.debugging_opts.share_generics { + match self.unstable_opts.share_generics { Some(setting) => setting, None => match self.optimize { OptLevel::No | OptLevel::Less | OptLevel::Size | OptLevel::SizeMin => true, @@ -782,7 +782,7 @@ impl Options { } } -impl DebuggingOptions { +impl UnstableOptions { pub fn diagnostic_handler_flags(&self, can_emit_warnings: bool) -> HandlerFlags { HandlerFlags { can_emit_warnings, @@ -940,7 +940,7 @@ fn default_configuration(sess: &Session) -> CrateConfig { let panic_strategy = sess.panic_strategy(); ret.insert((sym::panic, Some(panic_strategy.desc_symbol()))); - for s in sess.opts.debugging_opts.sanitizer { + for s in sess.opts.unstable_opts.sanitizer { let symbol = Symbol::intern(&s.to_string()); ret.insert((sym::sanitize, Some(symbol))); } @@ -1403,6 +1403,7 @@ pub fn rustc_short_optgroups() -> Vec<RustcOptGroup> { /// long-term interface for rustc. pub fn rustc_optgroups() -> Vec<RustcOptGroup> { let mut opts = rustc_short_optgroups(); + // FIXME: none of these descriptions are actually used opts.extend(vec![ opt::multi_s( "", @@ -1411,7 +1412,7 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> { "NAME[=PATH]", ), opt::opt_s("", "sysroot", "Override the system root", "PATH"), - opt::multi("Z", "", "Set internal debugging options", "FLAG"), + opt::multi("Z", "", "Set unstable / perma-unstable options", "FLAG"), opt::opt_s( "", "error-format", @@ -1659,12 +1660,12 @@ pub fn parse_crate_edition(matches: &getopts::Matches) -> Edition { edition } -fn check_debug_option_stability( - debugging_opts: &DebuggingOptions, +fn check_error_format_stability( + unstable_opts: &UnstableOptions, error_format: ErrorOutputType, json_rendered: HumanReadableErrorType, ) { - if !debugging_opts.unstable_options { + if !unstable_opts.unstable_options { if let ErrorOutputType::Json { pretty: true, json_rendered } = error_format { early_error( ErrorOutputType::Json { pretty: false, json_rendered }, @@ -1683,12 +1684,12 @@ fn check_debug_option_stability( } fn parse_output_types( - debugging_opts: &DebuggingOptions, + unstable_opts: &UnstableOptions, matches: &getopts::Matches, error_format: ErrorOutputType, ) -> OutputTypes { let mut output_types = BTreeMap::new(); - if !debugging_opts.parse_only { + if !unstable_opts.parse_only { for list in matches.opt_strs("emit") { for output_type in list.split(',') { let (shorthand, path) = match output_type.split_once('=') { @@ -1762,19 +1763,19 @@ fn should_override_cgus_and_disable_thinlto( (disable_thinlto, codegen_units) } -fn check_thread_count(debugging_opts: &DebuggingOptions, error_format: ErrorOutputType) { - if debugging_opts.threads == 0 { +fn check_thread_count(unstable_opts: &UnstableOptions, error_format: ErrorOutputType) { + if unstable_opts.threads == 0 { early_error(error_format, "value for threads must be a positive non-zero integer"); } - if debugging_opts.threads > 1 && debugging_opts.fuel.is_some() { + if unstable_opts.threads > 1 && unstable_opts.fuel.is_some() { early_error(error_format, "optimization fuel is incompatible with multiple threads"); } } fn collect_print_requests( cg: &mut CodegenOptions, - dopts: &mut DebuggingOptions, + unstable_opts: &mut UnstableOptions, matches: &getopts::Matches, error_format: ErrorOutputType, ) -> Vec<PrintRequest> { @@ -1803,7 +1804,7 @@ fn collect_print_requests( "native-static-libs" => PrintRequest::NativeStaticLibs, "stack-protector-strategies" => PrintRequest::StackProtectorStrategies, "target-spec-json" => { - if dopts.unstable_options { + if unstable_opts.unstable_options { PrintRequest::TargetSpec } else { early_error( @@ -2069,10 +2070,10 @@ fn parse_libs(matches: &getopts::Matches, error_format: ErrorOutputType) -> Vec< pub fn parse_externs( matches: &getopts::Matches, - debugging_opts: &DebuggingOptions, + unstable_opts: &UnstableOptions, error_format: ErrorOutputType, ) -> Externs { - let is_unstable_enabled = debugging_opts.unstable_options; + let is_unstable_enabled = unstable_opts.unstable_options; let mut externs: BTreeMap<String, ExternEntry> = BTreeMap::new(); for arg in matches.opt_strs("extern") { let (name, path) = match arg.split_once('=') { @@ -2171,7 +2172,7 @@ pub fn parse_externs( fn parse_remap_path_prefix( matches: &getopts::Matches, - debugging_opts: &DebuggingOptions, + unstable_opts: &UnstableOptions, error_format: ErrorOutputType, ) -> Vec<(PathBuf, PathBuf)> { let mut mapping: Vec<(PathBuf, PathBuf)> = matches @@ -2185,7 +2186,7 @@ fn parse_remap_path_prefix( Some((from, to)) => (PathBuf::from(from), PathBuf::from(to)), }) .collect(); - match &debugging_opts.remap_cwd_prefix { + match &unstable_opts.remap_cwd_prefix { Some(to) => match std::env::current_dir() { Ok(cwd) => mapping.push((cwd, to.clone())), Err(_) => (), @@ -2217,12 +2218,12 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { let crate_types = parse_crate_types_from_list(unparsed_crate_types) .unwrap_or_else(|e| early_error(error_format, &e)); - let mut debugging_opts = DebuggingOptions::build(matches, error_format); + let mut unstable_opts = UnstableOptions::build(matches, error_format); let (lint_opts, describe_lints, lint_cap) = get_cmd_lint_options(matches, error_format); - check_debug_option_stability(&debugging_opts, error_format, json_rendered); + check_error_format_stability(&unstable_opts, error_format, json_rendered); - if !debugging_opts.unstable_options && json_unused_externs.is_enabled() { + if !unstable_opts.unstable_options && json_unused_externs.is_enabled() { early_error( error_format, "the `-Z unstable-options` flag must also be passed to enable \ @@ -2230,7 +2231,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { ); } - let output_types = parse_output_types(&debugging_opts, matches, error_format); + let output_types = parse_output_types(&unstable_opts, matches, error_format); let mut cg = CodegenOptions::build(matches, error_format); let (disable_thinlto, mut codegen_units) = should_override_cgus_and_disable_thinlto( @@ -2240,20 +2241,19 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { cg.codegen_units, ); - check_thread_count(&debugging_opts, error_format); + check_thread_count(&unstable_opts, error_format); let incremental = cg.incremental.as_ref().map(PathBuf::from); - let assert_incr_state = - parse_assert_incr_state(&debugging_opts.assert_incr_state, error_format); + let assert_incr_state = parse_assert_incr_state(&unstable_opts.assert_incr_state, error_format); - if debugging_opts.profile && incremental.is_some() { + if unstable_opts.profile && incremental.is_some() { early_error( error_format, "can't instrument with gcov profiling when compiling incrementally", ); } - if debugging_opts.profile { + if unstable_opts.profile { match codegen_units { Some(1) => {} None => codegen_units = Some(1), @@ -2271,7 +2271,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { ); } - if debugging_opts.profile_sample_use.is_some() + if unstable_opts.profile_sample_use.is_some() && (cg.profile_generate.enabled() || cg.profile_use.is_some()) { early_error( @@ -2282,7 +2282,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { // Handle both `-Z symbol-mangling-version` and `-C symbol-mangling-version`; the latter takes // precedence. - match (cg.symbol_mangling_version, debugging_opts.symbol_mangling_version) { + match (cg.symbol_mangling_version, unstable_opts.symbol_mangling_version) { (Some(smv_c), Some(smv_z)) if smv_c != smv_z => { early_error( error_format, @@ -2291,7 +2291,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { ); } (Some(SymbolManglingVersion::V0), _) => {} - (Some(_), _) if !debugging_opts.unstable_options => { + (Some(_), _) if !unstable_opts.unstable_options => { early_error( error_format, "`-C symbol-mangling-version=legacy` requires `-Z unstable-options`", @@ -2310,7 +2310,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { // Handle both `-Z instrument-coverage` and `-C instrument-coverage`; the latter takes // precedence. - match (cg.instrument_coverage, debugging_opts.instrument_coverage) { + match (cg.instrument_coverage, unstable_opts.instrument_coverage) { (Some(ic_c), Some(ic_z)) if ic_c != ic_z => { early_error( error_format, @@ -2319,7 +2319,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { ); } (Some(InstrumentCoverage::Off | InstrumentCoverage::All), _) => {} - (Some(_), _) if !debugging_opts.unstable_options => { + (Some(_), _) if !unstable_opts.unstable_options => { early_error( error_format, "`-C instrument-coverage=except-*` requires `-Z unstable-options`", @@ -2363,7 +2363,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { } if let Ok(graphviz_font) = std::env::var("RUSTC_GRAPHVIZ_FONT") { - debugging_opts.graphviz_font = graphviz_font; + unstable_opts.graphviz_font = graphviz_font; } if !cg.embed_bitcode { @@ -2386,7 +2386,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { ); } - let prints = collect_print_requests(&mut cg, &mut debugging_opts, matches, error_format); + let prints = collect_print_requests(&mut cg, &mut unstable_opts, matches, error_format); let cg = cg; @@ -2412,15 +2412,15 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { early_warn(error_format, "-C remark requires \"-C debuginfo=n\" to show source locations"); } - let externs = parse_externs(matches, &debugging_opts, error_format); + let externs = parse_externs(matches, &unstable_opts, error_format); let crate_name = matches.opt_str("crate-name"); - let remap_path_prefix = parse_remap_path_prefix(matches, &debugging_opts, error_format); + let remap_path_prefix = parse_remap_path_prefix(matches, &unstable_opts, error_format); - let pretty = parse_pretty(&debugging_opts, error_format); + let pretty = parse_pretty(&unstable_opts, error_format); - if !debugging_opts.unstable_options + if !unstable_opts.unstable_options && !target_triple.triple().contains("apple") && cg.split_debuginfo.is_some() { @@ -2481,7 +2481,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { target_triple, test, incremental, - debugging_opts, + unstable_opts, prints, cg, error_format, @@ -2506,10 +2506,10 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { } } -fn parse_pretty(debugging_opts: &DebuggingOptions, efmt: ErrorOutputType) -> Option<PpMode> { +fn parse_pretty(unstable_opts: &UnstableOptions, efmt: ErrorOutputType) -> Option<PpMode> { use PpMode::*; - let first = match debugging_opts.unpretty.as_deref()? { + let first = match unstable_opts.unpretty.as_deref()? { "normal" => Source(PpSourceMode::Normal), "identified" => Source(PpSourceMode::Identified), "expanded" => Source(PpSourceMode::Expanded), diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 8f1057b793f..01ff9e254f7 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -104,7 +104,7 @@ macro_rules! top_level_options { impl Options { pub fn mir_opt_level(&self) -> usize { - self.debugging_opts + self.unstable_opts .mir_opt_level .unwrap_or_else(|| if self.optimize != OptLevel::No { 2 } else { 1 }) } @@ -177,7 +177,7 @@ top_level_options!( incremental: Option<PathBuf> [UNTRACKED], assert_incr_state: Option<IncrementalStateAssertion> [UNTRACKED], - debugging_opts: DebuggingOptions [SUBSTRUCT], + unstable_opts: UnstableOptions [SUBSTRUCT], prints: Vec<PrintRequest> [UNTRACKED], cg: CodegenOptions [SUBSTRUCT], externs: Externs [UNTRACKED], @@ -1187,12 +1187,13 @@ options! { } options! { - DebuggingOptions, DB_OPTIONS, dbopts, "Z", "debugging", + UnstableOptions, Z_OPTIONS, dbopts, "Z", "unstable", // This list is in alphabetical order. // // If you add a new option, please update: // - compiler/rustc_interface/src/tests.rs + // - src/doc/unstable-book/src/compiler-flags allow_features: Option<Vec<String>> = (None, parse_opt_comma_list, [TRACKED], "only allow the listed language features to be enabled in code (space separated)"), @@ -1580,6 +1581,8 @@ options! { `mir` (the MIR), or `mir-cfg` (graphviz formatted MIR)"), unsound_mir_opts: bool = (false, parse_bool, [TRACKED], "enable unsound and buggy MIR optimizations (default: no)"), + /// This name is kind of confusing: Most unstable options enable something themselves, while + /// this just allows "normal" options to be feature-gated. unstable_options: bool = (false, parse_bool, [UNTRACKED], "adds unstable command line options to rustc interface (default: no)"), use_ctors_section: Option<bool> = (None, parse_opt_bool, [TRACKED], diff --git a/compiler/rustc_session/src/session.rs b/compiler/rustc_session/src/session.rs index 16f4a099d80..854cad79a20 100644 --- a/compiler/rustc_session/src/session.rs +++ b/compiler/rustc_session/src/session.rs @@ -544,10 +544,10 @@ impl Session { /// warnings or errors are emitted. If no messages are emitted ("good path"), then /// it's likely a bug. pub fn delay_good_path_bug(&self, msg: impl Into<DiagnosticMessage>) { - if self.opts.debugging_opts.print_type_sizes - || self.opts.debugging_opts.query_dep_graph - || self.opts.debugging_opts.dump_mir.is_some() - || self.opts.debugging_opts.unpretty.is_some() + if self.opts.unstable_opts.print_type_sizes + || self.opts.unstable_opts.query_dep_graph + || self.opts.unstable_opts.dump_mir.is_some() + || self.opts.unstable_opts.unpretty.is_some() || self.opts.output_types.contains_key(&OutputType::Mir) || std::env::var_os("RUSTC_LOG").is_some() { @@ -584,31 +584,31 @@ impl Session { self.parse_sess.source_map() } pub fn verbose(&self) -> bool { - self.opts.debugging_opts.verbose + self.opts.unstable_opts.verbose } pub fn time_passes(&self) -> bool { - self.opts.debugging_opts.time_passes || self.opts.debugging_opts.time + self.opts.unstable_opts.time_passes || self.opts.unstable_opts.time } pub fn instrument_mcount(&self) -> bool { - self.opts.debugging_opts.instrument_mcount + self.opts.unstable_opts.instrument_mcount } pub fn time_llvm_passes(&self) -> bool { - self.opts.debugging_opts.time_llvm_passes + self.opts.unstable_opts.time_llvm_passes } pub fn meta_stats(&self) -> bool { - self.opts.debugging_opts.meta_stats + self.opts.unstable_opts.meta_stats } pub fn asm_comments(&self) -> bool { - self.opts.debugging_opts.asm_comments + self.opts.unstable_opts.asm_comments } pub fn verify_llvm_ir(&self) -> bool { - self.opts.debugging_opts.verify_llvm_ir || option_env!("RUSTC_VERIFY_LLVM_IR").is_some() + self.opts.unstable_opts.verify_llvm_ir || option_env!("RUSTC_VERIFY_LLVM_IR").is_some() } pub fn print_llvm_passes(&self) -> bool { - self.opts.debugging_opts.print_llvm_passes + self.opts.unstable_opts.print_llvm_passes } pub fn binary_dep_depinfo(&self) -> bool { - self.opts.debugging_opts.binary_dep_depinfo + self.opts.unstable_opts.binary_dep_depinfo } pub fn mir_opt_level(&self) -> usize { self.opts.mir_opt_level() @@ -675,7 +675,7 @@ impl Session { // If `-Z thinlto` specified process that, but note that this is mostly // a deprecated option now that `-C lto=thin` exists. - if let Some(enabled) = self.opts.debugging_opts.thinlto { + if let Some(enabled) = self.opts.unstable_opts.thinlto { if enabled { return config::Lto::ThinLocal; } else { @@ -703,25 +703,25 @@ impl Session { self.opts.cg.panic.unwrap_or(self.target.panic_strategy) } pub fn fewer_names(&self) -> bool { - if let Some(fewer_names) = self.opts.debugging_opts.fewer_names { + if let Some(fewer_names) = self.opts.unstable_opts.fewer_names { fewer_names } else { let more_names = self.opts.output_types.contains_key(&OutputType::LlvmAssembly) || self.opts.output_types.contains_key(&OutputType::Bitcode) // AddressSanitizer and MemorySanitizer use alloca name when reporting an issue. - || self.opts.debugging_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY); + || self.opts.unstable_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY); !more_names } } pub fn unstable_options(&self) -> bool { - self.opts.debugging_opts.unstable_options + self.opts.unstable_opts.unstable_options } pub fn is_nightly_build(&self) -> bool { self.opts.unstable_features.is_nightly_build() } pub fn is_sanitizer_cfi_enabled(&self) -> bool { - self.opts.debugging_opts.sanitizer.contains(SanitizerSet::CFI) + self.opts.unstable_opts.sanitizer.contains(SanitizerSet::CFI) } pub fn overflow_checks(&self) -> bool { self.opts.cg.overflow_checks.unwrap_or(self.opts.debug_assertions) @@ -761,13 +761,13 @@ impl Session { } pub fn tls_model(&self) -> TlsModel { - self.opts.debugging_opts.tls_model.unwrap_or(self.target.tls_model) + self.opts.unstable_opts.tls_model.unwrap_or(self.target.tls_model) } pub fn is_wasi_reactor(&self) -> bool { self.target.options.os == "wasi" && matches!( - self.opts.debugging_opts.wasi_exec_model, + self.opts.unstable_opts.wasi_exec_model, Some(config::WasiExecModel::Reactor) ) } @@ -778,7 +778,7 @@ impl Session { pub fn stack_protector(&self) -> StackProtector { if self.target.options.supports_stack_protector { - self.opts.debugging_opts.stack_protector + self.opts.unstable_opts.stack_protector } else { StackProtector::None } @@ -933,7 +933,7 @@ impl Session { /// This expends fuel if applicable, and records fuel if applicable. pub fn consider_optimizing<T: Fn() -> String>(&self, crate_name: &str, msg: T) -> bool { let mut ret = true; - if let Some((ref c, _)) = self.opts.debugging_opts.fuel { + if let Some((ref c, _)) = self.opts.unstable_opts.fuel { if c == crate_name { assert_eq!(self.threads(), 1); let mut fuel = self.optimization_fuel.lock(); @@ -951,7 +951,7 @@ impl Session { } } } - if let Some(ref c) = self.opts.debugging_opts.print_fuel { + if let Some(ref c) = self.opts.unstable_opts.print_fuel { if c == crate_name { assert_eq!(self.threads(), 1); self.print_fuel.fetch_add(1, SeqCst); @@ -963,7 +963,7 @@ impl Session { /// Returns the number of query threads that should be used for this /// compilation pub fn threads(&self) -> usize { - self.opts.debugging_opts.threads + self.opts.unstable_opts.threads } /// Returns the number of codegen units that should be used for this @@ -1037,7 +1037,7 @@ impl Session { } pub fn teach(&self, code: &DiagnosticId) -> bool { - self.opts.debugging_opts.teach && self.diagnostic().must_teach(code) + self.opts.unstable_opts.teach && self.diagnostic().must_teach(code) } pub fn rust_2015(&self) -> bool { @@ -1069,7 +1069,7 @@ impl Session { // The user can use the command line flag to override it. let needs_plt = self.target.needs_plt; - let dbg_opts = &self.opts.debugging_opts; + let dbg_opts = &self.opts.unstable_opts; let relro_level = dbg_opts.relro_level.unwrap_or(self.target.relro_level); @@ -1089,7 +1089,7 @@ impl Session { // AddressSanitizer uses lifetimes to detect use after scope bugs. // MemorySanitizer uses lifetimes to detect use of uninitialized stack variables. // HWAddressSanitizer will use lifetimes to detect use after scope bugs in the future. - || self.opts.debugging_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY | SanitizerSet::HWADDRESS) + || self.opts.unstable_opts.sanitizer.intersects(SanitizerSet::ADDRESS | SanitizerSet::MEMORY | SanitizerSet::HWADDRESS) } pub fn link_dead_code(&self) -> bool { @@ -1151,7 +1151,7 @@ fn default_emitter( fallback_bundle: LazyFallbackBundle, emitter_dest: Option<Box<dyn Write + Send>>, ) -> Box<dyn Emitter + sync::Send> { - let macro_backtrace = sopts.debugging_opts.macro_backtrace; + let macro_backtrace = sopts.unstable_opts.macro_backtrace; match (sopts.error_format, emitter_dest) { (config::ErrorOutputType::HumanReadable(kind), dst) => { let (short, color_config) = kind.unzip(); @@ -1164,7 +1164,7 @@ fn default_emitter( short, macro_backtrace, ); - Box::new(emitter.ui_testing(sopts.debugging_opts.ui_testing)) + Box::new(emitter.ui_testing(sopts.unstable_opts.ui_testing)) } else { let emitter = match dst { None => EmitterWriter::stderr( @@ -1173,7 +1173,7 @@ fn default_emitter( bundle, fallback_bundle, short, - sopts.debugging_opts.teach, + sopts.unstable_opts.teach, sopts.diagnostic_width, macro_backtrace, ), @@ -1189,7 +1189,7 @@ fn default_emitter( macro_backtrace, ), }; - Box::new(emitter.ui_testing(sopts.debugging_opts.ui_testing)) + Box::new(emitter.ui_testing(sopts.unstable_opts.ui_testing)) } } (config::ErrorOutputType::Json { pretty, json_rendered }, None) => Box::new( @@ -1203,7 +1203,7 @@ fn default_emitter( sopts.diagnostic_width, macro_backtrace, ) - .ui_testing(sopts.debugging_opts.ui_testing), + .ui_testing(sopts.unstable_opts.ui_testing), ), (config::ErrorOutputType::Json { pretty, json_rendered }, Some(dst)) => Box::new( JsonEmitter::new( @@ -1217,7 +1217,7 @@ fn default_emitter( sopts.diagnostic_width, macro_backtrace, ) - .ui_testing(sopts.debugging_opts.ui_testing), + .ui_testing(sopts.unstable_opts.ui_testing), ), } } @@ -1270,7 +1270,7 @@ pub fn build_session( } let loader = file_loader.unwrap_or_else(|| Box::new(RealFileLoader)); - let hash_kind = sopts.debugging_opts.src_hash_algorithm.unwrap_or_else(|| { + let hash_kind = sopts.unstable_opts.src_hash_algorithm.unwrap_or_else(|| { if target_cfg.is_like_msvc { SourceFileHashAlgorithm::Sha1 } else { @@ -1285,17 +1285,17 @@ pub fn build_session( let fallback_bundle = fallback_fluent_bundle( rustc_errors::DEFAULT_LOCALE_RESOURCES, - sopts.debugging_opts.translate_directionality_markers, + sopts.unstable_opts.translate_directionality_markers, ); let emitter = default_emitter(&sopts, registry, source_map.clone(), bundle, fallback_bundle, write_dest); let span_diagnostic = rustc_errors::Handler::with_emitter_and_flags( emitter, - sopts.debugging_opts.diagnostic_handler_flags(can_emit_warnings), + sopts.unstable_opts.diagnostic_handler_flags(can_emit_warnings), ); - let self_profiler = if let SwitchWithOptPath::Enabled(ref d) = sopts.debugging_opts.self_profile + let self_profiler = if let SwitchWithOptPath::Enabled(ref d) = sopts.unstable_opts.self_profile { let directory = if let Some(ref directory) = d { directory } else { std::path::Path::new(".") }; @@ -1303,8 +1303,8 @@ pub fn build_session( let profiler = SelfProfiler::new( directory, sopts.crate_name.as_deref(), - sopts.debugging_opts.self_profile_events.as_ref().map(|xs| &xs[..]), - &sopts.debugging_opts.self_profile_counter, + sopts.unstable_opts.self_profile_events.as_ref().map(|xs| &xs[..]), + &sopts.unstable_opts.self_profile_counter, ); match profiler { Ok(profiler) => Some(Arc::new(profiler)), @@ -1318,7 +1318,7 @@ pub fn build_session( }; let mut parse_sess = ParseSess::with_span_handler(span_diagnostic, source_map); - parse_sess.assume_incomplete_release = sopts.debugging_opts.assume_incomplete_release; + parse_sess.assume_incomplete_release = sopts.unstable_opts.assume_incomplete_release; let host_triple = config::host_triple(); let target_triple = sopts.target_triple.triple(); @@ -1337,12 +1337,12 @@ pub fn build_session( local_crate_source_file.map(|path| file_path_mapping.map_prefix(path).0); let optimization_fuel = Lock::new(OptimizationFuel { - remaining: sopts.debugging_opts.fuel.as_ref().map_or(0, |i| i.1), + remaining: sopts.unstable_opts.fuel.as_ref().map_or(0, |i| i.1), out_of_fuel: false, }); let print_fuel = AtomicU64::new(0); - let cgu_reuse_tracker = if sopts.debugging_opts.query_dep_graph { + let cgu_reuse_tracker = if sopts.unstable_opts.query_dep_graph { CguReuseTracker::new() } else { CguReuseTracker::new_disabled() @@ -1350,8 +1350,8 @@ pub fn build_session( let prof = SelfProfilerRef::new( self_profiler, - sopts.debugging_opts.time_passes || sopts.debugging_opts.time, - sopts.debugging_opts.time_passes, + sopts.unstable_opts.time_passes || sopts.unstable_opts.time, + sopts.unstable_opts.time_passes, ); let ctfe_backtrace = Lock::new(match env::var("RUSTC_CTFE_BACKTRACE") { @@ -1433,7 +1433,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } // Do the same for sample profile data. - if let Some(ref path) = sess.opts.debugging_opts.profile_sample_use { + if let Some(ref path) = sess.opts.unstable_opts.profile_sample_use { if !path.exists() { sess.err(&format!( "File `{}` passed to `-C profile-sample-use` does not exist.", @@ -1454,7 +1454,7 @@ fn validate_commandline_args_with_session_available(sess: &Session) { // Sanitizers can only be used on platforms that we know have working sanitizer codegen. let supported_sanitizers = sess.target.options.supported_sanitizers; - let unsupported_sanitizers = sess.opts.debugging_opts.sanitizer - supported_sanitizers; + let unsupported_sanitizers = sess.opts.unstable_opts.sanitizer - supported_sanitizers; match unsupported_sanitizers.into_iter().count() { 0 => {} 1 => { @@ -1471,13 +1471,13 @@ fn validate_commandline_args_with_session_available(sess: &Session) { } } // Cannot mix and match sanitizers. - let mut sanitizer_iter = sess.opts.debugging_opts.sanitizer.into_iter(); + let mut sanitizer_iter = sess.opts.unstable_opts.sanitizer.into_iter(); if let (Some(first), Some(second)) = (sanitizer_iter.next(), sanitizer_iter.next()) { sess.err(&format!("`-Zsanitizer={first}` is incompatible with `-Zsanitizer={second}`")); } // Cannot enable crt-static with sanitizers on Linux - if sess.crt_static(None) && !sess.opts.debugging_opts.sanitizer.is_empty() { + if sess.crt_static(None) && !sess.opts.unstable_opts.sanitizer.is_empty() { sess.err( "sanitizer is incompatible with statically linked libc, \ disable it using `-C target-feature=-crt-static`", @@ -1489,21 +1489,21 @@ fn validate_commandline_args_with_session_available(sess: &Session) { if sess.is_sanitizer_cfi_enabled() { sess.err("`-Zsanitizer=cfi` requires `-Clto`"); } - if sess.opts.debugging_opts.virtual_function_elimination { + if sess.opts.unstable_opts.virtual_function_elimination { sess.err("`-Zvirtual-function-elimination` requires `-Clto`"); } } - if sess.opts.debugging_opts.stack_protector != StackProtector::None { + if sess.opts.unstable_opts.stack_protector != StackProtector::None { if !sess.target.options.supports_stack_protector { sess.warn(&format!( "`-Z stack-protector={}` is not supported for target {} and will be ignored", - sess.opts.debugging_opts.stack_protector, sess.opts.target_triple + sess.opts.unstable_opts.stack_protector, sess.opts.target_triple )) } } - if let Some(dwarf_version) = sess.opts.debugging_opts.dwarf_version { + if let Some(dwarf_version) = sess.opts.unstable_opts.dwarf_version { if dwarf_version > 5 { sess.err(&format!("requested DWARF version {} is greater than 5", dwarf_version)); } |
