mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-20 11:43:04 +00:00
Auto merge of #98975 - jyn514:unstable_opts, r=wesleywiser
Rename `debugging_opts` to `unstable_opts` This is no longer used only for debugging options (e.g. `-Zoutput-width`, `-Zallow-features`). Rename it to be more clear. cc https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Codegen.20options.20.2F.20debugging.20options r? `@Amanieu` cc `@nikic` `@joshtriplett`
This commit is contained in:
commit
0ed9c64c3e
@ -427,7 +427,7 @@ pub fn lower_to_hir<'hir>(tcx: TyCtxt<'hir>, (): ()) -> hir::Crate<'hir> {
|
||||
sess.time("drop_ast", || std::mem::drop(krate));
|
||||
|
||||
// Discard hygiene data, which isn't required after lowering to HIR.
|
||||
if !sess.opts.debugging_opts.keep_hygiene_data {
|
||||
if !sess.opts.unstable_opts.keep_hygiene_data {
|
||||
rustc_span::hygiene::clear_syntax_context_map();
|
||||
}
|
||||
|
||||
@ -699,7 +699,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
|
||||
/// Intercept all spans entering HIR.
|
||||
/// Mark a span as relative to the current owning item.
|
||||
fn lower_span(&self, span: Span) -> Span {
|
||||
if self.tcx.sess.opts.debugging_opts.incremental_relative_spans {
|
||||
if self.tcx.sess.opts.unstable_opts.incremental_relative_spans {
|
||||
span.with_parent(Some(self.current_hir_id_owner))
|
||||
} else {
|
||||
// Do not make spans relative when not using incremental compilation.
|
||||
|
@ -40,7 +40,7 @@ pub(crate) trait AllFactsExt {
|
||||
impl AllFactsExt for AllFacts {
|
||||
/// Return
|
||||
fn enabled(tcx: TyCtxt<'_>) -> bool {
|
||||
tcx.sess.opts.debugging_opts.nll_facts || tcx.sess.opts.debugging_opts.polonius
|
||||
tcx.sess.opts.unstable_opts.nll_facts || tcx.sess.opts.unstable_opts.polonius
|
||||
}
|
||||
|
||||
fn write_to_dir(
|
||||
|
@ -231,7 +231,7 @@ fn do_mir_borrowck<'a, 'tcx>(
|
||||
let borrow_set =
|
||||
Rc::new(BorrowSet::build(tcx, body, locals_are_invalidated_at_exit, &mdpe.move_data));
|
||||
|
||||
let use_polonius = return_body_with_facts || infcx.tcx.sess.opts.debugging_opts.polonius;
|
||||
let use_polonius = return_body_with_facts || infcx.tcx.sess.opts.unstable_opts.polonius;
|
||||
|
||||
// Compute non-lexical lifetimes.
|
||||
let nll::NllOutput {
|
||||
|
@ -278,9 +278,9 @@ pub(crate) fn compute_regions<'cx, 'tcx>(
|
||||
|
||||
// Dump facts if requested.
|
||||
let polonius_output = all_facts.as_ref().and_then(|all_facts| {
|
||||
if infcx.tcx.sess.opts.debugging_opts.nll_facts {
|
||||
if infcx.tcx.sess.opts.unstable_opts.nll_facts {
|
||||
let def_path = infcx.tcx.def_path(def_id);
|
||||
let dir_path = PathBuf::from(&infcx.tcx.sess.opts.debugging_opts.nll_facts_dir)
|
||||
let dir_path = PathBuf::from(&infcx.tcx.sess.opts.unstable_opts.nll_facts_dir)
|
||||
.join(def_path.to_filename_friendly_no_crate());
|
||||
all_facts.write_to_dir(dir_path, location_table).unwrap();
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||
// In Polonius mode, the errors about missing universal region relations are in the output
|
||||
// and need to be emitted or propagated. Otherwise, we need to check whether the
|
||||
// constraints were too strong, and if so, emit or propagate those errors.
|
||||
if infcx.tcx.sess.opts.debugging_opts.polonius {
|
||||
if infcx.tcx.sess.opts.unstable_opts.polonius {
|
||||
self.check_polonius_subset_errors(
|
||||
body,
|
||||
outlives_requirements.as_mut(),
|
||||
|
@ -51,7 +51,7 @@ pub fn inject(sess: &Session, resolver: &mut dyn ResolverExpand, krate: &mut ast
|
||||
let test_runner = get_test_runner(sess, span_diagnostic, &krate);
|
||||
|
||||
if sess.opts.test {
|
||||
let panic_strategy = match (panic_strategy, sess.opts.debugging_opts.panic_abort_tests) {
|
||||
let panic_strategy = match (panic_strategy, sess.opts.unstable_opts.panic_abort_tests) {
|
||||
(PanicStrategy::Abort, true) => PanicStrategy::Abort,
|
||||
(PanicStrategy::Abort, false) => {
|
||||
if panic_strategy == platform_panic_strategy {
|
||||
|
@ -24,7 +24,7 @@ pub(crate) fn codegen(
|
||||
unwind_context,
|
||||
kind,
|
||||
tcx.lang_items().oom().is_some(),
|
||||
tcx.sess.opts.debugging_opts.oom,
|
||||
tcx.sess.opts.unstable_opts.oom,
|
||||
);
|
||||
true
|
||||
} else {
|
||||
|
@ -144,7 +144,7 @@ pub(crate) fn clif_int_or_float_cast(
|
||||
fx.bcx.ins().fcvt_to_uint_sat(to_ty, from)
|
||||
};
|
||||
|
||||
if let Some(false) = fx.tcx.sess.opts.debugging_opts.saturating_float_casts {
|
||||
if let Some(false) = fx.tcx.sess.opts.unstable_opts.saturating_float_casts {
|
||||
return val;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,7 @@ impl<'tcx> DebugContext<'tcx> {
|
||||
// In order to have a good line stepping behavior in debugger, we overwrite debug
|
||||
// locations of macro expansions with that of the outermost expansion site
|
||||
// (unless the crate is being compiled with `-Z debug-macros`).
|
||||
let span = if !span.from_expansion() || tcx.sess.opts.debugging_opts.debug_macros {
|
||||
let span = if !span.from_expansion() || tcx.sess.opts.unstable_opts.debug_macros {
|
||||
span
|
||||
} else {
|
||||
// Walk up the macro expansion chain until we reach a non-expanded span.
|
||||
|
@ -33,7 +33,7 @@ fn make_module(sess: &Session, isa: Box<dyn TargetIsa>, name: String) -> ObjectM
|
||||
// Unlike cg_llvm, cg_clif defaults to disabling -Zfunction-sections. For cg_llvm binary size
|
||||
// is important, while cg_clif cares more about compilation times. Enabling -Zfunction-sections
|
||||
// can easily double the amount of time necessary to perform linking.
|
||||
builder.per_function_section(sess.opts.debugging_opts.function_sections.unwrap_or(false));
|
||||
builder.per_function_section(sess.opts.unstable_opts.function_sections.unwrap_or(false));
|
||||
ObjectModule::new(builder)
|
||||
}
|
||||
|
||||
|
@ -676,7 +676,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
&& !layout.might_permit_raw_init(
|
||||
fx,
|
||||
InitKind::Zero,
|
||||
fx.tcx.sess.opts.debugging_opts.strict_init_checks) {
|
||||
fx.tcx.sess.opts.unstable_opts.strict_init_checks) {
|
||||
|
||||
with_no_trimmed_paths!({
|
||||
crate::base::codegen_panic(
|
||||
@ -692,7 +692,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
&& !layout.might_permit_raw_init(
|
||||
fx,
|
||||
InitKind::Uninit,
|
||||
fx.tcx.sess.opts.debugging_opts.strict_init_checks) {
|
||||
fx.tcx.sess.opts.unstable_opts.strict_init_checks) {
|
||||
|
||||
with_no_trimmed_paths!({
|
||||
crate::base::codegen_panic(
|
||||
|
@ -117,7 +117,7 @@ pub(crate) unsafe fn codegen(tcx: TyCtxt<'_>, mods: &mut GccContext, _module_nam
|
||||
|
||||
let name = OomStrategy::SYMBOL.to_string();
|
||||
let global = context.new_global(None, GlobalKind::Exported, i8, name);
|
||||
let value = tcx.sess.opts.debugging_opts.oom.should_panic();
|
||||
let value = tcx.sess.opts.unstable_opts.oom.should_panic();
|
||||
let value = context.new_rvalue_from_int(i8, value as i32);
|
||||
global.global_set_initializer_rvalue(value);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_
|
||||
// NOTE: Rust relies on LLVM not doing TBAA (https://github.com/rust-lang/unsafe-code-guidelines/issues/292).
|
||||
context.add_command_line_option("-fno-strict-aliasing");
|
||||
|
||||
if tcx.sess.opts.debugging_opts.function_sections.unwrap_or(tcx.sess.target.function_sections) {
|
||||
if tcx.sess.opts.unstable_opts.function_sections.unwrap_or(tcx.sess.target.function_sections) {
|
||||
context.add_command_line_option("-ffunction-sections");
|
||||
context.add_command_line_option("-fdata-sections");
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ fn should_use_mutable_noalias(cx: &CodegenCx<'_, '_>) -> bool {
|
||||
// LLVM prior to version 12 had known miscompiles in the presence of
|
||||
// noalias attributes (see #54878), but we don't support earlier
|
||||
// versions at all anymore. We now enable mutable noalias by default.
|
||||
cx.tcx.sess.opts.debugging_opts.mutable_noalias.unwrap_or(true)
|
||||
cx.tcx.sess.opts.unstable_opts.mutable_noalias.unwrap_or(true)
|
||||
}
|
||||
|
||||
const ABI_AFFECTING_ATTRIBUTES: [(ArgAttribute, llvm::AttributeKind); 1] =
|
||||
|
@ -145,7 +145,7 @@ pub(crate) unsafe fn codegen(
|
||||
if tcx.sess.target.default_hidden_visibility {
|
||||
llvm::LLVMRustSetVisibility(ll_g, llvm::Visibility::Hidden);
|
||||
}
|
||||
let val = tcx.sess.opts.debugging_opts.oom.should_panic();
|
||||
let val = tcx.sess.opts.unstable_opts.oom.should_panic();
|
||||
let llval = llvm::LLVMConstInt(i8, val as u64, False);
|
||||
llvm::LLVMSetInitializer(ll_g, llval);
|
||||
|
||||
|
@ -56,7 +56,7 @@ pub fn sanitize_attrs<'ll>(
|
||||
no_sanitize: SanitizerSet,
|
||||
) -> SmallVec<[&'ll Attribute; 4]> {
|
||||
let mut attrs = SmallVec::new();
|
||||
let enabled = cx.tcx.sess.opts.debugging_opts.sanitizer - no_sanitize;
|
||||
let enabled = cx.tcx.sess.opts.unstable_opts.sanitizer - no_sanitize;
|
||||
if enabled.contains(SanitizerSet::ADDRESS) {
|
||||
attrs.push(llvm::AttributeKind::SanitizeAddress.create_attr(cx.llcx));
|
||||
}
|
||||
@ -136,7 +136,7 @@ fn probestack_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
if cx
|
||||
.sess()
|
||||
.opts
|
||||
.debugging_opts
|
||||
.unstable_opts
|
||||
.sanitizer
|
||||
.intersects(SanitizerSet::ADDRESS | SanitizerSet::THREAD)
|
||||
{
|
||||
@ -149,7 +149,7 @@ fn probestack_attr<'ll>(cx: &CodegenCx<'ll, '_>) -> Option<&'ll Attribute> {
|
||||
}
|
||||
|
||||
// probestack doesn't play nice either with gcov profiling.
|
||||
if cx.sess().opts.debugging_opts.profile {
|
||||
if cx.sess().opts.unstable_opts.profile {
|
||||
return None;
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ pub fn from_fn_attrs<'ll, 'tcx>(
|
||||
to_add.push(uwtable_attr(cx.llcx));
|
||||
}
|
||||
|
||||
if cx.sess().opts.debugging_opts.profile_sample_use.is_some() {
|
||||
if cx.sess().opts.unstable_opts.profile_sample_use.is_some() {
|
||||
to_add.push(llvm::CreateAttrString(cx.llcx, "use-sample-profile"));
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ fn string_to_io_error(s: String) -> io::Error {
|
||||
|
||||
fn find_binutils_dlltool(sess: &Session) -> OsString {
|
||||
assert!(sess.target.options.is_like_windows && !sess.target.options.is_like_msvc);
|
||||
if let Some(dlltool_path) = &sess.opts.debugging_opts.dlltool {
|
||||
if let Some(dlltool_path) = &sess.opts.unstable_opts.dlltool {
|
||||
return dlltool_path.clone().into_os_string();
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ pub fn create_target_machine(tcx: TyCtxt<'_>, mod_name: &str) -> &'static mut ll
|
||||
let split_dwarf_file = if tcx.sess.target_can_use_split_dwarf() {
|
||||
tcx.output_filenames(()).split_dwarf_path(
|
||||
tcx.sess.split_debuginfo(),
|
||||
tcx.sess.opts.debugging_opts.split_dwarf_kind,
|
||||
tcx.sess.opts.unstable_opts.split_dwarf_kind,
|
||||
Some(mod_name),
|
||||
)
|
||||
} else {
|
||||
@ -182,9 +182,9 @@ pub fn target_machine_factory(
|
||||
let use_softfp = sess.opts.cg.soft_float;
|
||||
|
||||
let ffunction_sections =
|
||||
sess.opts.debugging_opts.function_sections.unwrap_or(sess.target.function_sections);
|
||||
sess.opts.unstable_opts.function_sections.unwrap_or(sess.target.function_sections);
|
||||
let fdata_sections = ffunction_sections;
|
||||
let funique_section_names = !sess.opts.debugging_opts.no_unique_section_names;
|
||||
let funique_section_names = !sess.opts.unstable_opts.no_unique_section_names;
|
||||
|
||||
let code_model = to_llvm_code_model(sess.code_model());
|
||||
|
||||
@ -202,15 +202,15 @@ pub fn target_machine_factory(
|
||||
let features = CString::new(target_features.join(",")).unwrap();
|
||||
let abi = SmallCStr::new(&sess.target.llvm_abiname);
|
||||
let trap_unreachable =
|
||||
sess.opts.debugging_opts.trap_unreachable.unwrap_or(sess.target.trap_unreachable);
|
||||
let emit_stack_size_section = sess.opts.debugging_opts.emit_stack_sizes;
|
||||
sess.opts.unstable_opts.trap_unreachable.unwrap_or(sess.target.trap_unreachable);
|
||||
let emit_stack_size_section = sess.opts.unstable_opts.emit_stack_sizes;
|
||||
|
||||
let asm_comments = sess.asm_comments();
|
||||
let relax_elf_relocations =
|
||||
sess.opts.debugging_opts.relax_elf_relocations.unwrap_or(sess.target.relax_elf_relocations);
|
||||
sess.opts.unstable_opts.relax_elf_relocations.unwrap_or(sess.target.relax_elf_relocations);
|
||||
|
||||
let use_init_array =
|
||||
!sess.opts.debugging_opts.use_ctors_section.unwrap_or(sess.target.use_ctors_section);
|
||||
!sess.opts.unstable_opts.use_ctors_section.unwrap_or(sess.target.use_ctors_section);
|
||||
|
||||
let path_mapping = sess.source_map().path_mapping().clone();
|
||||
|
||||
|
@ -64,7 +64,7 @@ pub fn const_alloc_to_llvm<'ll>(cx: &CodegenCx<'ll, '_>, alloc: ConstAllocation<
|
||||
// See https://github.com/rust-lang/rust/issues/84565.
|
||||
1
|
||||
} else {
|
||||
cx.sess().opts.debugging_opts.uninit_const_chunk_threshold
|
||||
cx.sess().opts.unstable_opts.uninit_const_chunk_threshold
|
||||
};
|
||||
let allow_uninit_chunks = chunks.clone().take(max.saturating_add(1)).count() <= max;
|
||||
|
||||
|
@ -275,7 +275,7 @@ pub unsafe fn create_module<'ll>(
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(BranchProtection { bti, pac_ret }) = sess.opts.debugging_opts.branch_protection {
|
||||
if let Some(BranchProtection { bti, pac_ret }) = sess.opts.unstable_opts.branch_protection {
|
||||
if sess.target.arch != "aarch64" {
|
||||
sess.err("-Zbranch-protection is only supported on aarch64");
|
||||
} else {
|
||||
@ -308,7 +308,7 @@ pub unsafe fn create_module<'ll>(
|
||||
}
|
||||
|
||||
// Pass on the control-flow protection flags to LLVM (equivalent to `-fcf-protection` in Clang).
|
||||
if let CFProtection::Branch | CFProtection::Full = sess.opts.debugging_opts.cf_protection {
|
||||
if let CFProtection::Branch | CFProtection::Full = sess.opts.unstable_opts.cf_protection {
|
||||
llvm::LLVMRustAddModuleFlag(
|
||||
llmod,
|
||||
llvm::LLVMModFlagBehavior::Override,
|
||||
@ -316,7 +316,7 @@ pub unsafe fn create_module<'ll>(
|
||||
1,
|
||||
)
|
||||
}
|
||||
if let CFProtection::Return | CFProtection::Full = sess.opts.debugging_opts.cf_protection {
|
||||
if let CFProtection::Return | CFProtection::Full = sess.opts.unstable_opts.cf_protection {
|
||||
llvm::LLVMRustAddModuleFlag(
|
||||
llmod,
|
||||
llvm::LLVMModFlagBehavior::Override,
|
||||
@ -325,7 +325,7 @@ pub unsafe fn create_module<'ll>(
|
||||
)
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.virtual_function_elimination {
|
||||
if sess.opts.unstable_opts.virtual_function_elimination {
|
||||
llvm::LLVMRustAddModuleFlag(
|
||||
llmod,
|
||||
llvm::LLVMModFlagBehavior::Error,
|
||||
|
@ -824,7 +824,7 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
|
||||
output_filenames
|
||||
.split_dwarf_path(
|
||||
tcx.sess.split_debuginfo(),
|
||||
tcx.sess.opts.debugging_opts.split_dwarf_kind,
|
||||
tcx.sess.opts.unstable_opts.split_dwarf_kind,
|
||||
Some(codegen_unit_name),
|
||||
)
|
||||
// We get a path relative to the working directory from split_dwarf_path
|
||||
@ -881,15 +881,15 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
|
||||
split_name.len(),
|
||||
kind,
|
||||
0,
|
||||
tcx.sess.opts.debugging_opts.split_dwarf_inlining,
|
||||
tcx.sess.opts.unstable_opts.split_dwarf_inlining,
|
||||
);
|
||||
|
||||
if tcx.sess.opts.debugging_opts.profile {
|
||||
if tcx.sess.opts.unstable_opts.profile {
|
||||
let cu_desc_metadata =
|
||||
llvm::LLVMRustMetadataAsValue(debug_context.llcontext, unit_metadata);
|
||||
let default_gcda_path = &output_filenames.with_extension("gcda");
|
||||
let gcda_path =
|
||||
tcx.sess.opts.debugging_opts.profile_emit.as_ref().unwrap_or(default_gcda_path);
|
||||
tcx.sess.opts.unstable_opts.profile_emit.as_ref().unwrap_or(default_gcda_path);
|
||||
|
||||
let gcov_cu_info = [
|
||||
path_to_mdstring(debug_context.llcontext, &output_filenames.with_extension("gcno")),
|
||||
@ -1559,7 +1559,7 @@ pub fn create_vtable_di_node<'ll, 'tcx>(
|
||||
) {
|
||||
// FIXME(flip1995): The virtual function elimination optimization only works with full LTO in
|
||||
// LLVM at the moment.
|
||||
if cx.sess().opts.debugging_opts.virtual_function_elimination && cx.sess().lto() == Lto::Fat {
|
||||
if cx.sess().opts.unstable_opts.virtual_function_elimination && cx.sess().lto() == Lto::Fat {
|
||||
vcall_visibility_metadata(cx, ty, poly_trait_ref, vtable);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ impl<'ll, 'tcx> CodegenUnitDebugContext<'ll, 'tcx> {
|
||||
// This can be overridden using --llvm-opts -dwarf-version,N.
|
||||
// Android has the same issue (#22398)
|
||||
let dwarf_version =
|
||||
sess.opts.debugging_opts.dwarf_version.unwrap_or(sess.target.default_dwarf_version);
|
||||
sess.opts.unstable_opts.dwarf_version.unwrap_or(sess.target.default_dwarf_version);
|
||||
llvm::LLVMRustAddModuleFlag(
|
||||
self.llmod,
|
||||
llvm::LLVMModFlagBehavior::Warning,
|
||||
|
@ -355,7 +355,7 @@ impl CodegenBackend for LlvmCodegenBackend {
|
||||
.join(sess);
|
||||
|
||||
sess.time("llvm_dump_timing_file", || {
|
||||
if sess.opts.debugging_opts.llvm_time_trace {
|
||||
if sess.opts.unstable_opts.llvm_time_trace {
|
||||
let file_name = outputs.with_extension("llvm_timings.json");
|
||||
llvm_util::time_trace_profiler_finish(&file_name);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ unsafe fn configure_llvm(sess: &Session) {
|
||||
add("-debug-pass=Structure", false);
|
||||
}
|
||||
if sess.target.generate_arange_section
|
||||
&& !sess.opts.debugging_opts.no_generate_arange_section
|
||||
&& !sess.opts.unstable_opts.no_generate_arange_section
|
||||
{
|
||||
add("-generate-arange-section", false);
|
||||
}
|
||||
@ -102,7 +102,7 @@ unsafe fn configure_llvm(sess: &Session) {
|
||||
add("-enable-machine-outliner=never", false);
|
||||
}
|
||||
|
||||
match sess.opts.debugging_opts.merge_functions.unwrap_or(sess.target.merge_functions) {
|
||||
match sess.opts.unstable_opts.merge_functions.unwrap_or(sess.target.merge_functions) {
|
||||
MergeFunctions::Disabled | MergeFunctions::Trampolines => {}
|
||||
MergeFunctions::Aliases => {
|
||||
add("-mergefunc-use-aliases", false);
|
||||
@ -125,7 +125,7 @@ unsafe fn configure_llvm(sess: &Session) {
|
||||
}
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.llvm_time_trace {
|
||||
if sess.opts.unstable_opts.llvm_time_trace {
|
||||
llvm::LLVMTimeTraceProfilerInitialize();
|
||||
}
|
||||
|
||||
@ -133,11 +133,11 @@ unsafe fn configure_llvm(sess: &Session) {
|
||||
|
||||
// Use the legacy plugin registration if we don't use the new pass manager
|
||||
if !should_use_new_llvm_pass_manager(
|
||||
&sess.opts.debugging_opts.new_llvm_pass_manager,
|
||||
&sess.opts.unstable_opts.new_llvm_pass_manager,
|
||||
&sess.target.arch,
|
||||
) {
|
||||
// Register LLVM plugins by loading them into the compiler process.
|
||||
for plugin in &sess.opts.debugging_opts.llvm_plugins {
|
||||
for plugin in &sess.opts.unstable_opts.llvm_plugins {
|
||||
let lib = Library::new(plugin).unwrap_or_else(|e| bug!("couldn't load plugin: {}", e));
|
||||
debug!("LLVM plugin loaded successfully {:?} ({})", lib, plugin);
|
||||
|
||||
@ -541,7 +541,7 @@ fn backend_feature_name(s: &str) -> Option<&str> {
|
||||
}
|
||||
|
||||
pub fn tune_cpu(sess: &Session) -> Option<&str> {
|
||||
let name = sess.opts.debugging_opts.tune_cpu.as_ref()?;
|
||||
let name = sess.opts.unstable_opts.tune_cpu.as_ref()?;
|
||||
Some(handle_native(name))
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ pub fn link_binary<'a, B: ArchiveBuilder<'a>>(
|
||||
let output_metadata = sess.opts.output_types.contains_key(&OutputType::Metadata);
|
||||
for &crate_type in sess.crate_types().iter() {
|
||||
// Ignore executable crates if we have -Z no-codegen, as they will error.
|
||||
if (sess.opts.debugging_opts.no_codegen || !sess.opts.output_types.should_codegen())
|
||||
if (sess.opts.unstable_opts.no_codegen || !sess.opts.output_types.should_codegen())
|
||||
&& !output_metadata
|
||||
&& crate_type == CrateType::Executable
|
||||
{
|
||||
@ -595,7 +595,7 @@ fn link_dwarf_object<'a>(
|
||||
let mut package = thorin::DwarfPackage::new(&thorin_sess);
|
||||
|
||||
// Input objs contain .o/.dwo files from the current crate.
|
||||
match sess.opts.debugging_opts.split_dwarf_kind {
|
||||
match sess.opts.unstable_opts.split_dwarf_kind {
|
||||
SplitDwarfKind::Single => {
|
||||
for input_obj in cg_results.modules.iter().filter_map(|m| m.object.as_ref()) {
|
||||
package.add_input_object(input_obj)?;
|
||||
@ -1022,7 +1022,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
|
||||
|
||||
// Temporarily support both -Z strip and -C strip
|
||||
fn strip_value(sess: &Session) -> Strip {
|
||||
match (sess.opts.debugging_opts.strip, sess.opts.cg.strip) {
|
||||
match (sess.opts.unstable_opts.strip, sess.opts.cg.strip) {
|
||||
(s, Strip::None) => s,
|
||||
(_, s) => s,
|
||||
}
|
||||
@ -1074,7 +1074,7 @@ fn add_sanitizer_libraries(sess: &Session, crate_type: CrateType, linker: &mut d
|
||||
return;
|
||||
}
|
||||
|
||||
let sanitizer = sess.opts.debugging_opts.sanitizer;
|
||||
let sanitizer = sess.opts.unstable_opts.sanitizer;
|
||||
if sanitizer.contains(SanitizerSet::ADDRESS) {
|
||||
link_sanitizer_runtime(sess, linker, "asan");
|
||||
}
|
||||
@ -1253,7 +1253,7 @@ fn preserve_objects_for_their_debuginfo(sess: &Session) -> (bool, bool) {
|
||||
return (false, false);
|
||||
}
|
||||
|
||||
match (sess.split_debuginfo(), sess.opts.debugging_opts.split_dwarf_kind) {
|
||||
match (sess.split_debuginfo(), sess.opts.unstable_opts.split_dwarf_kind) {
|
||||
// If there is no split debuginfo then do not preserve objects.
|
||||
(SplitDebuginfo::Off, _) => (false, false),
|
||||
// If there is packed split debuginfo, then the debuginfo in the objects
|
||||
@ -1601,7 +1601,7 @@ fn add_pre_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor)
|
||||
if let Some(args) = sess.target.pre_link_args.get(&flavor) {
|
||||
cmd.args(args.iter().map(Deref::deref));
|
||||
}
|
||||
cmd.args(&sess.opts.debugging_opts.pre_link_args);
|
||||
cmd.args(&sess.opts.unstable_opts.pre_link_args);
|
||||
}
|
||||
|
||||
/// Add a link script embedded in the target, if applicable.
|
||||
@ -1809,7 +1809,7 @@ fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained:
|
||||
/// Add options making relocation sections in the produced ELF files read-only
|
||||
/// and suppressing lazy binding.
|
||||
fn add_relro_args(cmd: &mut dyn Linker, sess: &Session) {
|
||||
match sess.opts.debugging_opts.relro_level.unwrap_or(sess.target.relro_level) {
|
||||
match sess.opts.unstable_opts.relro_level.unwrap_or(sess.target.relro_level) {
|
||||
RelroLevel::Full => cmd.full_relro(),
|
||||
RelroLevel::Partial => cmd.partial_relro(),
|
||||
RelroLevel::Off => cmd.no_relro(),
|
||||
@ -1957,7 +1957,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
|
||||
// (or alternatively link all native libraries after their respective crates).
|
||||
// This change is somewhat breaking in practice due to local static libraries being linked
|
||||
// as whole-archive (#85144), so removing whole-archive may be a pre-requisite.
|
||||
if sess.opts.debugging_opts.link_native_libraries {
|
||||
if sess.opts.unstable_opts.link_native_libraries {
|
||||
add_local_native_libraries(cmd, sess, codegen_results);
|
||||
}
|
||||
|
||||
@ -1969,7 +1969,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>(
|
||||
// If -Zlink-native-libraries=false is set, then the assumption is that an
|
||||
// external build system already has the native dependencies defined, and it
|
||||
// will provide them to the linker itself.
|
||||
if sess.opts.debugging_opts.link_native_libraries {
|
||||
if sess.opts.unstable_opts.link_native_libraries {
|
||||
add_upstream_native_libraries(cmd, sess, codegen_results);
|
||||
}
|
||||
|
||||
@ -2037,7 +2037,7 @@ fn add_order_independent_options(
|
||||
add_link_script(cmd, sess, tmpdir, crate_type);
|
||||
|
||||
if sess.target.os == "fuchsia" && crate_type == CrateType::Executable {
|
||||
let prefix = if sess.opts.debugging_opts.sanitizer.contains(SanitizerSet::ADDRESS) {
|
||||
let prefix = if sess.opts.unstable_opts.sanitizer.contains(SanitizerSet::ADDRESS) {
|
||||
"asan/"
|
||||
} else {
|
||||
""
|
||||
@ -2362,7 +2362,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(
|
||||
// If -Zlink-native-libraries=false is set, then the assumption is that an
|
||||
// external build system already has the native dependencies defined, and it
|
||||
// will provide them to the linker itself.
|
||||
if sess.opts.debugging_opts.link_native_libraries {
|
||||
if sess.opts.unstable_opts.link_native_libraries {
|
||||
let mut last = (None, NativeLibKind::Unspecified, None);
|
||||
for lib in &codegen_results.crate_info.native_libraries[&cnum] {
|
||||
let Some(name) = lib.name else {
|
||||
@ -2709,7 +2709,7 @@ fn get_apple_sdk_root(sdk_name: &str) -> Result<String, String> {
|
||||
}
|
||||
|
||||
fn add_gcc_ld_path(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
|
||||
if let Some(ld_impl) = sess.opts.debugging_opts.gcc_ld {
|
||||
if let Some(ld_impl) = sess.opts.unstable_opts.gcc_ld {
|
||||
if let LinkerFlavor::Gcc = flavor {
|
||||
match ld_impl {
|
||||
LdImpl::Lld => {
|
||||
|
@ -303,7 +303,7 @@ impl<'a> GccLinker<'a> {
|
||||
config::OptLevel::Aggressive => "O3",
|
||||
};
|
||||
|
||||
if let Some(path) = &self.sess.opts.debugging_opts.profile_sample_use {
|
||||
if let Some(path) = &self.sess.opts.unstable_opts.profile_sample_use {
|
||||
self.linker_arg(&format!("-plugin-opt=sample-profile={}", path.display()));
|
||||
};
|
||||
self.linker_args(&[
|
||||
@ -325,7 +325,7 @@ impl<'a> GccLinker<'a> {
|
||||
// purely to support rustbuild right now, we should get a more
|
||||
// principled solution at some point to force the compiler to pass
|
||||
// the right `-Wl,-install_name` with an `@rpath` in it.
|
||||
if self.sess.opts.cg.rpath || self.sess.opts.debugging_opts.osx_rpath_install_name {
|
||||
if self.sess.opts.cg.rpath || self.sess.opts.unstable_opts.osx_rpath_install_name {
|
||||
let mut rpath = OsString::from("@rpath/");
|
||||
rpath.push(out_filename.file_name().unwrap());
|
||||
self.linker_args(&[OsString::from("-install_name"), rpath]);
|
||||
|
@ -232,15 +232,15 @@ fn exported_symbols_provider_local<'tcx>(
|
||||
}));
|
||||
}
|
||||
|
||||
if tcx.sess.opts.debugging_opts.sanitizer.contains(SanitizerSet::MEMORY) {
|
||||
if tcx.sess.opts.unstable_opts.sanitizer.contains(SanitizerSet::MEMORY) {
|
||||
let mut msan_weak_symbols = Vec::new();
|
||||
|
||||
// Similar to profiling, preserve weak msan symbol during LTO.
|
||||
if tcx.sess.opts.debugging_opts.sanitizer_recover.contains(SanitizerSet::MEMORY) {
|
||||
if tcx.sess.opts.unstable_opts.sanitizer_recover.contains(SanitizerSet::MEMORY) {
|
||||
msan_weak_symbols.push("__msan_keep_going");
|
||||
}
|
||||
|
||||
if tcx.sess.opts.debugging_opts.sanitizer_memory_track_origins != 0 {
|
||||
if tcx.sess.opts.unstable_opts.sanitizer_memory_track_origins != 0 {
|
||||
msan_weak_symbols.push("__msan_track_origins");
|
||||
}
|
||||
|
||||
|
@ -179,24 +179,24 @@ impl ModuleConfig {
|
||||
SwitchWithOptPath::Disabled
|
||||
),
|
||||
pgo_use: if_regular!(sess.opts.cg.profile_use.clone(), None),
|
||||
pgo_sample_use: if_regular!(sess.opts.debugging_opts.profile_sample_use.clone(), None),
|
||||
debug_info_for_profiling: sess.opts.debugging_opts.debug_info_for_profiling,
|
||||
pgo_sample_use: if_regular!(sess.opts.unstable_opts.profile_sample_use.clone(), None),
|
||||
debug_info_for_profiling: sess.opts.unstable_opts.debug_info_for_profiling,
|
||||
instrument_coverage: if_regular!(sess.instrument_coverage(), false),
|
||||
instrument_gcov: if_regular!(
|
||||
// compiler_builtins overrides the codegen-units settings,
|
||||
// which is incompatible with -Zprofile which requires that
|
||||
// only a single codegen unit is used per crate.
|
||||
sess.opts.debugging_opts.profile && !is_compiler_builtins,
|
||||
sess.opts.unstable_opts.profile && !is_compiler_builtins,
|
||||
false
|
||||
),
|
||||
|
||||
sanitizer: if_regular!(sess.opts.debugging_opts.sanitizer, SanitizerSet::empty()),
|
||||
sanitizer: if_regular!(sess.opts.unstable_opts.sanitizer, SanitizerSet::empty()),
|
||||
sanitizer_recover: if_regular!(
|
||||
sess.opts.debugging_opts.sanitizer_recover,
|
||||
sess.opts.unstable_opts.sanitizer_recover,
|
||||
SanitizerSet::empty()
|
||||
),
|
||||
sanitizer_memory_track_origins: if_regular!(
|
||||
sess.opts.debugging_opts.sanitizer_memory_track_origins,
|
||||
sess.opts.unstable_opts.sanitizer_memory_track_origins,
|
||||
0
|
||||
),
|
||||
|
||||
@ -247,7 +247,7 @@ impl ModuleConfig {
|
||||
// O2 and O3) since it can be useful for reducing code size.
|
||||
merge_functions: match sess
|
||||
.opts
|
||||
.debugging_opts
|
||||
.unstable_opts
|
||||
.merge_functions
|
||||
.unwrap_or(sess.target.merge_functions)
|
||||
{
|
||||
@ -259,9 +259,9 @@ impl ModuleConfig {
|
||||
},
|
||||
|
||||
inline_threshold: sess.opts.cg.inline_threshold,
|
||||
new_llvm_pass_manager: sess.opts.debugging_opts.new_llvm_pass_manager,
|
||||
new_llvm_pass_manager: sess.opts.unstable_opts.new_llvm_pass_manager,
|
||||
emit_lifetime_markers: sess.emit_lifetime_markers(),
|
||||
llvm_plugins: if_regular!(sess.opts.debugging_opts.llvm_plugins.clone(), vec![]),
|
||||
llvm_plugins: if_regular!(sess.opts.unstable_opts.llvm_plugins.clone(), vec![]),
|
||||
}
|
||||
}
|
||||
|
||||
@ -926,7 +926,7 @@ fn finish_intra_module_work<B: ExtraBackendMethods>(
|
||||
) -> Result<WorkItemResult<B>, FatalError> {
|
||||
let diag_handler = cgcx.create_diag_handler();
|
||||
|
||||
if !cgcx.opts.debugging_opts.combine_cgu
|
||||
if !cgcx.opts.unstable_opts.combine_cgu
|
||||
|| module.kind == ModuleKind::Metadata
|
||||
|| module.kind == ModuleKind::Allocator
|
||||
{
|
||||
@ -1048,14 +1048,13 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
||||
each_linked_rlib_for_lto.push((cnum, path.to_path_buf()));
|
||||
}));
|
||||
|
||||
let ol = if tcx.sess.opts.debugging_opts.no_codegen
|
||||
|| !tcx.sess.opts.output_types.should_codegen()
|
||||
{
|
||||
// If we know that we won’t be doing codegen, create target machines without optimisation.
|
||||
config::OptLevel::No
|
||||
} else {
|
||||
tcx.backend_optimization_level(())
|
||||
};
|
||||
let ol =
|
||||
if tcx.sess.opts.unstable_opts.no_codegen || !tcx.sess.opts.output_types.should_codegen() {
|
||||
// If we know that we won’t be doing codegen, create target machines without optimisation.
|
||||
config::OptLevel::No
|
||||
} else {
|
||||
tcx.backend_optimization_level(())
|
||||
};
|
||||
let backend_features = tcx.global_backend_features(());
|
||||
let cgcx = CodegenContext::<B> {
|
||||
backend: backend.clone(),
|
||||
@ -1064,7 +1063,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
||||
lto: sess.lto(),
|
||||
fewer_names: sess.fewer_names(),
|
||||
save_temps: sess.opts.cg.save_temps,
|
||||
time_trace: sess.opts.debugging_opts.llvm_time_trace,
|
||||
time_trace: sess.opts.unstable_opts.llvm_time_trace,
|
||||
opts: Arc::new(sess.opts.clone()),
|
||||
prof: sess.prof.clone(),
|
||||
exported_symbols,
|
||||
@ -1087,7 +1086,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
||||
target_arch: tcx.sess.target.arch.to_string(),
|
||||
debuginfo: tcx.sess.opts.debuginfo,
|
||||
split_debuginfo: tcx.sess.split_debuginfo(),
|
||||
split_dwarf_kind: tcx.sess.opts.debugging_opts.split_dwarf_kind,
|
||||
split_dwarf_kind: tcx.sess.opts.unstable_opts.split_dwarf_kind,
|
||||
};
|
||||
|
||||
// This is the "main loop" of parallel work happening for parallel codegen.
|
||||
@ -1346,7 +1345,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
||||
.binary_search_by_key(&cost, |&(_, cost)| cost)
|
||||
.unwrap_or_else(|e| e);
|
||||
work_items.insert(insertion_index, (work, cost));
|
||||
if !cgcx.opts.debugging_opts.no_parallel_llvm {
|
||||
if !cgcx.opts.unstable_opts.no_parallel_llvm {
|
||||
helper.request_token();
|
||||
}
|
||||
}
|
||||
@ -1466,7 +1465,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
||||
};
|
||||
work_items.insert(insertion_index, (llvm_work_item, cost));
|
||||
|
||||
if !cgcx.opts.debugging_opts.no_parallel_llvm {
|
||||
if !cgcx.opts.unstable_opts.no_parallel_llvm {
|
||||
helper.request_token();
|
||||
}
|
||||
assert!(!codegen_aborted);
|
||||
|
@ -521,7 +521,7 @@ pub fn codegen_crate<B: ExtraBackendMethods>(
|
||||
need_metadata_module: bool,
|
||||
) -> OngoingCodegen<B> {
|
||||
// Skip crate items and just output metadata in -Z no-codegen mode.
|
||||
if tcx.sess.opts.debugging_opts.no_codegen || !tcx.sess.opts.output_types.should_codegen() {
|
||||
if tcx.sess.opts.unstable_opts.no_codegen || !tcx.sess.opts.output_types.should_codegen() {
|
||||
let ongoing_codegen = start_async_codegen(backend, tcx, target_cpu, metadata, None, 1);
|
||||
|
||||
ongoing_codegen.codegen_finished(tcx);
|
||||
|
@ -25,7 +25,7 @@ impl<'a, 'tcx> VirtualIndex {
|
||||
let llty = bx.fn_ptr_backend_type(fn_abi);
|
||||
let llvtable = bx.pointercast(llvtable, bx.type_ptr_to(llty));
|
||||
|
||||
if bx.cx().sess().opts.debugging_opts.virtual_function_elimination
|
||||
if bx.cx().sess().opts.unstable_opts.virtual_function_elimination
|
||||
&& bx.cx().sess().lto() == Lto::Fat
|
||||
{
|
||||
let typeid =
|
||||
|
@ -687,7 +687,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
source_info,
|
||||
target,
|
||||
cleanup,
|
||||
self.cx.tcx().sess.opts.debugging_opts.strict_init_checks,
|
||||
self.cx.tcx().sess.opts.unstable_opts.strict_init_checks,
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
return span;
|
||||
}
|
||||
|
||||
if span.from_expansion() && !self.cx.sess().opts.debugging_opts.debug_macros {
|
||||
if span.from_expansion() && !self.cx.sess().opts.unstable_opts.debug_macros {
|
||||
// Walk up the macro expansion chain until we reach a non-expanded span.
|
||||
// We also stop at the function body level because no line stepping can occur
|
||||
// at the level above that.
|
||||
|
@ -221,7 +221,7 @@ pub trait BuilderMethods<'a, 'tcx>:
|
||||
assert!(matches!(self.cx().type_kind(float_ty), TypeKind::Float | TypeKind::Double));
|
||||
assert_eq!(self.cx().type_kind(int_ty), TypeKind::Integer);
|
||||
|
||||
if let Some(false) = self.cx().sess().opts.debugging_opts.saturating_float_casts {
|
||||
if let Some(false) = self.cx().sess().opts.unstable_opts.saturating_float_casts {
|
||||
return if signed { self.fptosi(x, dest_ty) } else { self.fptoui(x, dest_ty) };
|
||||
}
|
||||
|
||||
|
@ -417,7 +417,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
&& !layout.might_permit_raw_init(
|
||||
self,
|
||||
InitKind::Zero,
|
||||
self.tcx.sess.opts.debugging_opts.strict_init_checks,
|
||||
self.tcx.sess.opts.unstable_opts.strict_init_checks,
|
||||
)
|
||||
{
|
||||
M::abort(
|
||||
@ -432,7 +432,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
&& !layout.might_permit_raw_init(
|
||||
self,
|
||||
InitKind::Uninit,
|
||||
self.tcx.sess.opts.debugging_opts.strict_init_checks,
|
||||
self.tcx.sess.opts.unstable_opts.strict_init_checks,
|
||||
)
|
||||
{
|
||||
M::abort(
|
||||
|
@ -80,7 +80,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
line: u32,
|
||||
col: u32,
|
||||
) -> MPlaceTy<'tcx, M::PointerTag> {
|
||||
let loc_details = &self.tcx.sess.opts.debugging_opts.location_detail;
|
||||
let loc_details = &self.tcx.sess.opts.unstable_opts.location_detail;
|
||||
let file = if loc_details.file {
|
||||
self.allocate_str(filename.as_str(), MemoryKind::CallerLocation, Mutability::Not)
|
||||
} else {
|
||||
|
@ -41,7 +41,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||
let pair = Immediate::ScalarPair(val.into(), Scalar::from_bool(overflowed).into());
|
||||
self.write_immediate(pair, dest)?;
|
||||
} else {
|
||||
assert!(self.tcx.sess.opts.debugging_opts.randomize_layout);
|
||||
assert!(self.tcx.sess.opts.unstable_opts.randomize_layout);
|
||||
// With randomized layout, `(int, bool)` might cease to be a `ScalarPair`, so we have to
|
||||
// do a component-wise write here. This code path is slower than the above because
|
||||
// `place_field` will have to `force_allocate` locals here.
|
||||
|
@ -312,7 +312,7 @@ impl<'mir, 'tcx> Checker<'mir, 'tcx> {
|
||||
Status::Forbidden => None,
|
||||
};
|
||||
|
||||
if self.tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
|
||||
if self.tcx.sess.opts.unstable_opts.unleash_the_miri_inside_of_you {
|
||||
self.tcx.sess.miri_unleashed_feature(span, gate);
|
||||
return;
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypeChecker<'a, 'tcx> {
|
||||
|
||||
fn visit_operand(&mut self, operand: &Operand<'tcx>, location: Location) {
|
||||
// This check is somewhat expensive, so only run it when -Zvalidate-mir is passed.
|
||||
if self.tcx.sess.opts.debugging_opts.validate_mir && self.mir_phase < MirPhase::DropsLowered
|
||||
if self.tcx.sess.opts.unstable_opts.validate_mir && self.mir_phase < MirPhase::DropsLowered
|
||||
{
|
||||
// `Operand::Copy` is only supposed to be used with `Copy` types.
|
||||
if let Operand::Copy(place) = operand {
|
||||
|
@ -29,7 +29,7 @@ use rustc_log::stdout_isatty;
|
||||
use rustc_metadata::locator;
|
||||
use rustc_save_analysis as save;
|
||||
use rustc_save_analysis::DumpHandler;
|
||||
use rustc_session::config::{nightly_options, CG_OPTIONS, DB_OPTIONS};
|
||||
use rustc_session::config::{nightly_options, CG_OPTIONS, Z_OPTIONS};
|
||||
use rustc_session::config::{ErrorOutputType, Input, OutputType, PrintRequest, TrimmedDefPaths};
|
||||
use rustc_session::cstore::MetadataLoader;
|
||||
use rustc_session::getopts;
|
||||
@ -124,7 +124,7 @@ impl Callbacks for TimePassesCallbacks {
|
||||
// If a --prints=... option has been given, we don't print the "total"
|
||||
// time because it will mess up the --prints output. See #64339.
|
||||
self.time_passes = config.opts.prints.is_empty()
|
||||
&& (config.opts.debugging_opts.time_passes || config.opts.debugging_opts.time);
|
||||
&& (config.opts.unstable_opts.time_passes || config.opts.unstable_opts.time);
|
||||
config.opts.trimmed_def_paths = TrimmedDefPaths::GoodPath;
|
||||
}
|
||||
}
|
||||
@ -248,7 +248,7 @@ fn run_compiler(
|
||||
let sopts = &compiler.session().opts;
|
||||
if sopts.describe_lints {
|
||||
let mut lint_store = rustc_lint::new_lint_store(
|
||||
sopts.debugging_opts.no_interleave_lints,
|
||||
sopts.unstable_opts.no_interleave_lints,
|
||||
compiler.session().unstable_options(),
|
||||
);
|
||||
let registered_lints =
|
||||
@ -342,7 +342,7 @@ fn run_compiler(
|
||||
return early_exit();
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.parse_only || sess.opts.debugging_opts.show_span.is_some() {
|
||||
if sess.opts.unstable_opts.parse_only || sess.opts.unstable_opts.show_span.is_some() {
|
||||
return early_exit();
|
||||
}
|
||||
|
||||
@ -371,13 +371,13 @@ fn run_compiler(
|
||||
|
||||
queries.global_ctxt()?;
|
||||
|
||||
if sess.opts.debugging_opts.no_analysis {
|
||||
if sess.opts.unstable_opts.no_analysis {
|
||||
return early_exit();
|
||||
}
|
||||
|
||||
queries.global_ctxt()?.peek_mut().enter(|tcx| {
|
||||
let result = tcx.analysis(());
|
||||
if sess.opts.debugging_opts.save_analysis {
|
||||
if sess.opts.unstable_opts.save_analysis {
|
||||
let crate_name = queries.crate_name()?.peek().clone();
|
||||
sess.time("save_analysis", || {
|
||||
save::process_crate(
|
||||
@ -401,7 +401,7 @@ fn run_compiler(
|
||||
|
||||
queries.ongoing_codegen()?;
|
||||
|
||||
if sess.opts.debugging_opts.print_type_sizes {
|
||||
if sess.opts.unstable_opts.print_type_sizes {
|
||||
sess.code_stats.print_type_sizes();
|
||||
}
|
||||
|
||||
@ -414,14 +414,14 @@ fn run_compiler(
|
||||
linker.link()?
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.perf_stats {
|
||||
if sess.opts.unstable_opts.perf_stats {
|
||||
sess.print_perf_stats();
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.print_fuel.is_some() {
|
||||
if sess.opts.unstable_opts.print_fuel.is_some() {
|
||||
eprintln!(
|
||||
"Fuel used by {}: {}",
|
||||
sess.opts.debugging_opts.print_fuel.as_ref().unwrap(),
|
||||
sess.opts.unstable_opts.print_fuel.as_ref().unwrap(),
|
||||
sess.print_fuel.load(SeqCst)
|
||||
);
|
||||
}
|
||||
@ -576,7 +576,7 @@ fn show_content_with_pager(content: &str) {
|
||||
}
|
||||
|
||||
pub fn try_process_rlink(sess: &Session, compiler: &interface::Compiler) -> Compilation {
|
||||
if sess.opts.debugging_opts.link_only {
|
||||
if sess.opts.unstable_opts.link_only {
|
||||
if let Input::File(file) = compiler.input() {
|
||||
// FIXME: #![crate_type] and #![crate_name] support not implemented yet
|
||||
sess.init_crate_types(collect_crate_types(sess, &[]));
|
||||
@ -606,7 +606,7 @@ pub fn list_metadata(
|
||||
metadata_loader: &dyn MetadataLoader,
|
||||
input: &Input,
|
||||
) -> Compilation {
|
||||
if sess.opts.debugging_opts.ls {
|
||||
if sess.opts.unstable_opts.ls {
|
||||
match *input {
|
||||
Input::File(ref ifile) => {
|
||||
let path = &(*ifile);
|
||||
@ -928,7 +928,7 @@ Available lint options:
|
||||
|
||||
fn describe_debug_flags() {
|
||||
println!("\nAvailable options:\n");
|
||||
print_flag_list("-Z", config::DB_OPTIONS);
|
||||
print_flag_list("-Z", config::Z_OPTIONS);
|
||||
}
|
||||
|
||||
fn describe_codegen_flags() {
|
||||
@ -1000,7 +1000,7 @@ pub fn handle_options(args: &[String]) -> Option<getopts::Matches> {
|
||||
getopts::Fail::UnrecognizedOption(ref opt) => CG_OPTIONS
|
||||
.iter()
|
||||
.map(|&(name, ..)| ('C', name))
|
||||
.chain(DB_OPTIONS.iter().map(|&(name, ..)| ('Z', name)))
|
||||
.chain(Z_OPTIONS.iter().map(|&(name, ..)| ('Z', name)))
|
||||
.find(|&(_, name)| *opt == name.replace('_', "-"))
|
||||
.map(|(flag, _)| format!("{}. Did you mean `-{} {}`?", e, flag, opt)),
|
||||
_ => None,
|
||||
|
@ -171,7 +171,7 @@ fn get_features(
|
||||
continue;
|
||||
}
|
||||
|
||||
if let Some(allowed) = sess.opts.debugging_opts.allow_features.as_ref() {
|
||||
if let Some(allowed) = sess.opts.unstable_opts.allow_features.as_ref() {
|
||||
if allowed.iter().all(|f| name.as_str() != f) {
|
||||
struct_span_err!(
|
||||
span_handler,
|
||||
|
@ -564,7 +564,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
|
||||
.resolver
|
||||
.visit_ast_fragment_with_placeholders(self.cx.current_expansion.id, &fragment);
|
||||
|
||||
if self.cx.sess.opts.debugging_opts.incremental_relative_spans {
|
||||
if self.cx.sess.opts.unstable_opts.incremental_relative_spans {
|
||||
for (invoc, _) in invocations.iter_mut() {
|
||||
let expn_id = invoc.expansion_data.id;
|
||||
let parent_def = self.cx.resolver.invocation_parent(expn_id);
|
||||
|
@ -55,11 +55,11 @@ use std::io::{BufWriter, Write};
|
||||
#[allow(missing_docs)]
|
||||
pub fn assert_dep_graph(tcx: TyCtxt<'_>) {
|
||||
tcx.dep_graph.with_ignore(|| {
|
||||
if tcx.sess.opts.debugging_opts.dump_dep_graph {
|
||||
if tcx.sess.opts.unstable_opts.dump_dep_graph {
|
||||
tcx.dep_graph.with_query(dump_graph);
|
||||
}
|
||||
|
||||
if !tcx.sess.opts.debugging_opts.query_dep_graph {
|
||||
if !tcx.sess.opts.unstable_opts.query_dep_graph {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -81,7 +81,7 @@ pub fn assert_dep_graph(tcx: TyCtxt<'_>) {
|
||||
|
||||
if !if_this_changed.is_empty() || !then_this_would_need.is_empty() {
|
||||
assert!(
|
||||
tcx.sess.opts.debugging_opts.query_dep_graph,
|
||||
tcx.sess.opts.unstable_opts.query_dep_graph,
|
||||
"cannot use the `#[{}]` or `#[{}]` annotations \
|
||||
without supplying `-Z query-dep-graph`",
|
||||
sym::rustc_if_this_changed,
|
||||
|
@ -76,7 +76,7 @@ impl<'tcx> AssertModuleSource<'tcx> {
|
||||
return;
|
||||
};
|
||||
|
||||
if !self.tcx.sess.opts.debugging_opts.query_dep_graph {
|
||||
if !self.tcx.sess.opts.unstable_opts.query_dep_graph {
|
||||
self.tcx.sess.span_fatal(
|
||||
attr.span,
|
||||
"found CGU-reuse attribute but `-Zquery-dep-graph` was not specified",
|
||||
|
@ -134,7 +134,7 @@ struct Assertion {
|
||||
}
|
||||
|
||||
pub fn check_dirty_clean_annotations(tcx: TyCtxt<'_>) {
|
||||
if !tcx.sess.opts.debugging_opts.query_dep_graph {
|
||||
if !tcx.sess.opts.unstable_opts.query_dep_graph {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,7 @@ fn copy_files(sess: &Session, target_dir: &Path, source_dir: &Path) -> Result<bo
|
||||
}
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.incremental_info {
|
||||
if sess.opts.unstable_opts.incremental_info {
|
||||
eprintln!(
|
||||
"[incremental] session directory: \
|
||||
{} files hard-linked",
|
||||
|
@ -141,7 +141,7 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
|
||||
// Calling `sess.incr_comp_session_dir()` will panic if `sess.opts.incremental.is_none()`.
|
||||
// Fortunately, we just checked that this isn't the case.
|
||||
let path = dep_graph_path(&sess);
|
||||
let report_incremental_info = sess.opts.debugging_opts.incremental_info;
|
||||
let report_incremental_info = sess.opts.unstable_opts.incremental_info;
|
||||
let expected_hash = sess.opts.dep_tracking_hash(false);
|
||||
|
||||
let mut prev_work_products = FxHashMap::default();
|
||||
@ -163,7 +163,7 @@ pub fn load_dep_graph(sess: &Session) -> DepGraphFuture {
|
||||
for swp in work_products {
|
||||
let all_files_exist = swp.work_product.saved_files.iter().all(|(_, path)| {
|
||||
let exists = in_incr_comp_dir_sess(sess, path).exists();
|
||||
if !exists && sess.opts.debugging_opts.incremental_info {
|
||||
if !exists && sess.opts.unstable_opts.incremental_info {
|
||||
eprintln!("incremental: could not find file for work product: {path}",);
|
||||
}
|
||||
exists
|
||||
@ -225,7 +225,7 @@ pub fn load_query_result_cache<'a, C: OnDiskCache<'a>>(sess: &'a Session) -> Opt
|
||||
let _prof_timer = sess.prof.generic_activity("incr_comp_load_query_result_cache");
|
||||
|
||||
match load_data(
|
||||
sess.opts.debugging_opts.incremental_info,
|
||||
sess.opts.unstable_opts.incremental_info,
|
||||
&query_cache_path(sess),
|
||||
sess.is_nightly_build(),
|
||||
) {
|
||||
|
@ -39,7 +39,7 @@ pub fn save_dep_graph(tcx: TyCtxt<'_>) {
|
||||
sess.time("assert_dep_graph", || crate::assert_dep_graph(tcx));
|
||||
sess.time("check_dirty_clean", || dirty_clean::check_dirty_clean_annotations(tcx));
|
||||
|
||||
if sess.opts.debugging_opts.incremental_info {
|
||||
if sess.opts.unstable_opts.incremental_info {
|
||||
tcx.dep_graph.print_incremental_info()
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ pub fn build_dep_graph(
|
||||
prev_graph,
|
||||
prev_work_products,
|
||||
encoder,
|
||||
sess.opts.debugging_opts.query_dep_graph,
|
||||
sess.opts.debugging_opts.incremental_info,
|
||||
sess.opts.unstable_opts.query_dep_graph,
|
||||
sess.opts.unstable_opts.incremental_info,
|
||||
))
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
// subtyping errors that it would have caught will now be
|
||||
// caught later on, during region checking. However, we
|
||||
// continue to use it for a transition period.
|
||||
if self.tcx.sess.opts.debugging_opts.no_leak_check || self.skip_leak_check.get() {
|
||||
if self.tcx.sess.opts.unstable_opts.no_leak_check || self.skip_leak_check.get() {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
@ -300,7 +300,7 @@ pub fn create_compiler_and_run<R>(config: Config, f: impl FnOnce(&Compiler) -> R
|
||||
);
|
||||
}
|
||||
|
||||
let temps_dir = sess.opts.debugging_opts.temps_dir.as_ref().map(|o| PathBuf::from(&o));
|
||||
let temps_dir = sess.opts.unstable_opts.temps_dir.as_ref().map(|o| PathBuf::from(&o));
|
||||
|
||||
let compiler = Compiler {
|
||||
sess,
|
||||
@ -333,7 +333,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
|
||||
tracing::trace!("run_compiler");
|
||||
util::run_in_thread_pool_with_globals(
|
||||
config.opts.edition,
|
||||
config.opts.debugging_opts.threads,
|
||||
config.opts.unstable_opts.threads,
|
||||
|| create_compiler_and_run(config, f),
|
||||
)
|
||||
}
|
||||
|
@ -58,16 +58,16 @@ pub fn parse<'a>(sess: &'a Session, input: &Input) -> PResult<'a, ast::Crate> {
|
||||
}
|
||||
})?;
|
||||
|
||||
if sess.opts.debugging_opts.input_stats {
|
||||
if sess.opts.unstable_opts.input_stats {
|
||||
eprintln!("Lines of code: {}", sess.source_map().count_lines());
|
||||
eprintln!("Pre-expansion node count: {}", count_nodes(&krate));
|
||||
}
|
||||
|
||||
if let Some(ref s) = sess.opts.debugging_opts.show_span {
|
||||
if let Some(ref s) = sess.opts.unstable_opts.show_span {
|
||||
rustc_ast_passes::show_span::run(sess.diagnostic(), s, &krate);
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.hir_stats {
|
||||
if sess.opts.unstable_opts.hir_stats {
|
||||
hir_stats::print_ast_stats(&krate, "PRE EXPANSION AST STATS");
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ pub fn register_plugins<'a>(
|
||||
rustc_builtin_macros::cmdline_attrs::inject(
|
||||
krate,
|
||||
&sess.parse_sess,
|
||||
&sess.opts.debugging_opts.crate_attr,
|
||||
&sess.opts.unstable_opts.crate_attr,
|
||||
)
|
||||
});
|
||||
|
||||
@ -213,7 +213,7 @@ pub fn register_plugins<'a>(
|
||||
}
|
||||
|
||||
let mut lint_store = rustc_lint::new_lint_store(
|
||||
sess.opts.debugging_opts.no_interleave_lints,
|
||||
sess.opts.unstable_opts.no_interleave_lints,
|
||||
sess.unstable_options(),
|
||||
);
|
||||
register_lints(sess, &mut lint_store);
|
||||
@ -327,10 +327,10 @@ pub fn configure_and_expand(
|
||||
let cfg = rustc_expand::expand::ExpansionConfig {
|
||||
features: Some(features),
|
||||
recursion_limit,
|
||||
trace_mac: sess.opts.debugging_opts.trace_macros,
|
||||
trace_mac: sess.opts.unstable_opts.trace_macros,
|
||||
should_test: sess.opts.test,
|
||||
span_debug: sess.opts.debugging_opts.span_debug,
|
||||
proc_macro_backtrace: sess.opts.debugging_opts.proc_macro_backtrace,
|
||||
span_debug: sess.opts.unstable_opts.span_debug,
|
||||
proc_macro_backtrace: sess.opts.unstable_opts.proc_macro_backtrace,
|
||||
..rustc_expand::expand::ExpansionConfig::default(crate_name.to_string())
|
||||
};
|
||||
|
||||
@ -413,11 +413,11 @@ pub fn configure_and_expand(
|
||||
|
||||
// Done with macro expansion!
|
||||
|
||||
if sess.opts.debugging_opts.input_stats {
|
||||
if sess.opts.unstable_opts.input_stats {
|
||||
eprintln!("Post-expansion node count: {}", count_nodes(&krate));
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.hir_stats {
|
||||
if sess.opts.unstable_opts.hir_stats {
|
||||
hir_stats::print_ast_stats(&krate, "POST EXPANSION AST STATS");
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ fn generated_output_paths(
|
||||
out_filenames.push(p);
|
||||
}
|
||||
}
|
||||
OutputType::DepInfo if sess.opts.debugging_opts.dep_info_omit_d_target => {
|
||||
OutputType::DepInfo if sess.opts.unstable_opts.dep_info_omit_d_target => {
|
||||
// Don't add the dep-info output when omitting it from dep-info targets
|
||||
}
|
||||
_ => {
|
||||
@ -598,7 +598,7 @@ fn write_out_deps(
|
||||
files.extend(extra_tracked_files);
|
||||
|
||||
if sess.binary_dep_depinfo() {
|
||||
if let Some(ref backend) = sess.opts.debugging_opts.codegen_backend {
|
||||
if let Some(ref backend) = sess.opts.unstable_opts.codegen_backend {
|
||||
if backend.contains('.') {
|
||||
// If the backend name contain a `.`, it is the path to an external dynamic
|
||||
// library. If not, it is not a path.
|
||||
@ -928,7 +928,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
|
||||
sess.time("MIR_effect_checking", || {
|
||||
for def_id in tcx.hir().body_owners() {
|
||||
tcx.ensure().thir_check_unsafety(def_id);
|
||||
if !tcx.sess.opts.debugging_opts.thir_unsafeck {
|
||||
if !tcx.sess.opts.unstable_opts.thir_unsafeck {
|
||||
rustc_mir_transform::check_unsafety::check_unsafety(tcx, def_id);
|
||||
}
|
||||
tcx.ensure().has_ffi_unwind_calls(def_id);
|
||||
|
@ -357,7 +357,7 @@ impl Linker {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if sess.opts.debugging_opts.no_link {
|
||||
if sess.opts.unstable_opts.no_link {
|
||||
let encoded = CodegenResults::serialize_rlink(&codegen_results);
|
||||
let rlink_file = self.prepare_outputs.with_extension(config::RLINK_EXT);
|
||||
std::fs::write(&rlink_file, encoded).map_err(|err| {
|
||||
|
@ -629,14 +629,14 @@ fn test_top_level_options_tracked_no_crate() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_debugging_options_tracking_hash() {
|
||||
fn test_unstable_options_tracking_hash() {
|
||||
let reference = Options::default();
|
||||
let mut opts = Options::default();
|
||||
|
||||
macro_rules! untracked {
|
||||
($name: ident, $non_default_value: expr) => {
|
||||
assert_ne!(opts.debugging_opts.$name, $non_default_value);
|
||||
opts.debugging_opts.$name = $non_default_value;
|
||||
assert_ne!(opts.unstable_opts.$name, $non_default_value);
|
||||
opts.unstable_opts.$name = $non_default_value;
|
||||
assert_same_hash(&reference, &opts);
|
||||
};
|
||||
}
|
||||
@ -705,8 +705,8 @@ fn test_debugging_options_tracking_hash() {
|
||||
macro_rules! tracked {
|
||||
($name: ident, $non_default_value: expr) => {
|
||||
opts = reference.clone();
|
||||
assert_ne!(opts.debugging_opts.$name, $non_default_value);
|
||||
opts.debugging_opts.$name = $non_default_value;
|
||||
assert_ne!(opts.unstable_opts.$name, $non_default_value);
|
||||
opts.unstable_opts.$name = $non_default_value;
|
||||
assert_different_hash(&reference, &opts);
|
||||
};
|
||||
}
|
||||
@ -804,8 +804,8 @@ fn test_debugging_options_tracking_hash() {
|
||||
macro_rules! tracked_no_crate_hash {
|
||||
($name: ident, $non_default_value: expr) => {
|
||||
opts = reference.clone();
|
||||
assert_ne!(opts.debugging_opts.$name, $non_default_value);
|
||||
opts.debugging_opts.$name = $non_default_value;
|
||||
assert_ne!(opts.unstable_opts.$name, $non_default_value);
|
||||
opts.unstable_opts.$name = $non_default_value;
|
||||
assert_non_crate_hash_different(&reference, &opts);
|
||||
};
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ pub fn create_session(
|
||||
} else {
|
||||
get_codegen_backend(
|
||||
&sopts.maybe_sysroot,
|
||||
sopts.debugging_opts.codegen_backend.as_ref().map(|name| &name[..]),
|
||||
sopts.unstable_opts.codegen_backend.as_ref().map(|name| &name[..]),
|
||||
)
|
||||
};
|
||||
|
||||
@ -89,9 +89,9 @@ pub fn create_session(
|
||||
let bundle = match rustc_errors::fluent_bundle(
|
||||
sopts.maybe_sysroot.clone(),
|
||||
sysroot_candidates(),
|
||||
sopts.debugging_opts.translate_lang.clone(),
|
||||
sopts.debugging_opts.translate_additional_ftl.as_deref(),
|
||||
sopts.debugging_opts.translate_directionality_markers,
|
||||
sopts.unstable_opts.translate_lang.clone(),
|
||||
sopts.unstable_opts.translate_additional_ftl.as_deref(),
|
||||
sopts.unstable_opts.translate_directionality_markers,
|
||||
) {
|
||||
Ok(bundle) => bundle,
|
||||
Err(e) => {
|
||||
|
@ -416,7 +416,7 @@ pub fn check_ast_node<'a>(
|
||||
let mut passes: Vec<_> = passes.iter().map(|p| (p)()).collect();
|
||||
let mut buffered = lint_buffer.unwrap_or_default();
|
||||
|
||||
if sess.opts.debugging_opts.no_interleave_lints {
|
||||
if sess.opts.unstable_opts.no_interleave_lints {
|
||||
for (i, pass) in passes.iter_mut().enumerate() {
|
||||
buffered =
|
||||
sess.prof.extra_verbose_generic_activity("run_lint", pass.name()).run(|| {
|
||||
|
@ -402,7 +402,7 @@ pub fn late_lint_mod<'tcx, T: LateLintPass<'tcx>>(
|
||||
module_def_id: LocalDefId,
|
||||
builtin_lints: T,
|
||||
) {
|
||||
if tcx.sess.opts.debugging_opts.no_interleave_lints {
|
||||
if tcx.sess.opts.unstable_opts.no_interleave_lints {
|
||||
// These passes runs in late_lint_crate with -Z no_interleave_lints
|
||||
return;
|
||||
}
|
||||
@ -448,7 +448,7 @@ fn late_lint_pass_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, pass: T)
|
||||
fn late_lint_crate<'tcx, T: LateLintPass<'tcx>>(tcx: TyCtxt<'tcx>, builtin_lints: T) {
|
||||
let mut passes = unerased_lint_store(tcx).late_passes.iter().map(|p| (p)()).collect::<Vec<_>>();
|
||||
|
||||
if !tcx.sess.opts.debugging_opts.no_interleave_lints {
|
||||
if !tcx.sess.opts.unstable_opts.no_interleave_lints {
|
||||
if !passes.is_empty() {
|
||||
late_lint_pass_crate(tcx, LateLintPassObjects { lints: &mut passes[..] });
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ impl<'a> CrateLoader<'a> {
|
||||
proc_macro_locator.is_proc_macro = true;
|
||||
|
||||
// Load the proc macro crate for the target
|
||||
let (locator, target_result) = if self.sess.opts.debugging_opts.dual_proc_macros {
|
||||
let (locator, target_result) = if self.sess.opts.unstable_opts.dual_proc_macros {
|
||||
proc_macro_locator.reset();
|
||||
let result = match self.load(&mut proc_macro_locator)? {
|
||||
Some(LoadResult::Previous(cnum)) => {
|
||||
@ -485,7 +485,7 @@ impl<'a> CrateLoader<'a> {
|
||||
return Ok(None);
|
||||
};
|
||||
|
||||
Ok(Some(if self.sess.opts.debugging_opts.dual_proc_macros {
|
||||
Ok(Some(if self.sess.opts.unstable_opts.dual_proc_macros {
|
||||
let host_result = match host_result {
|
||||
LoadResult::Previous(..) => {
|
||||
panic!("host and target proc macros must be loaded in lock-step")
|
||||
@ -762,9 +762,9 @@ impl<'a> CrateLoader<'a> {
|
||||
}
|
||||
|
||||
fn inject_profiler_runtime(&mut self, krate: &ast::Crate) {
|
||||
if self.sess.opts.debugging_opts.no_profiler_runtime
|
||||
if self.sess.opts.unstable_opts.no_profiler_runtime
|
||||
|| !(self.sess.instrument_coverage()
|
||||
|| self.sess.opts.debugging_opts.profile
|
||||
|| self.sess.opts.unstable_opts.profile
|
||||
|| self.sess.opts.cg.profile_generate.enabled())
|
||||
{
|
||||
return;
|
||||
@ -772,7 +772,7 @@ impl<'a> CrateLoader<'a> {
|
||||
|
||||
info!("loading profiler");
|
||||
|
||||
let name = Symbol::intern(&self.sess.opts.debugging_opts.profiler_runtime);
|
||||
let name = Symbol::intern(&self.sess.opts.unstable_opts.profiler_runtime);
|
||||
if name == sym::profiler_builtins && self.sess.contains_name(&krate.attrs, sym::no_core) {
|
||||
self.sess.err(
|
||||
"`profiler_builtins` crate (required by compiler options) \
|
||||
|
@ -419,7 +419,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
|
||||
}
|
||||
|
||||
let found_drop_strategy = tcx.panic_in_drop_strategy(cnum);
|
||||
if tcx.sess.opts.debugging_opts.panic_in_drop != found_drop_strategy {
|
||||
if tcx.sess.opts.unstable_opts.panic_in_drop != found_drop_strategy {
|
||||
sess.err(&format!(
|
||||
"the crate `{}` is compiled with the \
|
||||
panic-in-drop strategy `{}` which is \
|
||||
@ -427,7 +427,7 @@ fn verify_ok(tcx: TyCtxt<'_>, list: &[Linkage]) {
|
||||
strategy of `{}`",
|
||||
tcx.crate_name(cnum),
|
||||
found_drop_strategy.desc(),
|
||||
tcx.sess.opts.debugging_opts.panic_in_drop.desc()
|
||||
tcx.sess.opts.unstable_opts.panic_in_drop.desc()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -1179,7 +1179,7 @@ impl CrateError {
|
||||
err.help("consider building the standard library from source with `cargo build -Zbuild-std`");
|
||||
}
|
||||
} else if crate_name
|
||||
== Symbol::intern(&sess.opts.debugging_opts.profiler_runtime)
|
||||
== Symbol::intern(&sess.opts.unstable_opts.profiler_runtime)
|
||||
{
|
||||
err.note("the compiler may have been built without the profiler runtime");
|
||||
} else if crate_name.as_str().starts_with("rustc_") {
|
||||
|
@ -1475,14 +1475,14 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
// the `rust-src` component in `Src::run` in `src/bootstrap/dist.rs`.
|
||||
let virtual_rust_source_base_dir = [
|
||||
option_env!("CFG_VIRTUAL_RUST_SOURCE_BASE_DIR").map(PathBuf::from),
|
||||
sess.opts.debugging_opts.simulate_remapped_rust_src_base.clone(),
|
||||
sess.opts.unstable_opts.simulate_remapped_rust_src_base.clone(),
|
||||
]
|
||||
.into_iter()
|
||||
.filter(|_| {
|
||||
// Only spend time on further checks if we have what to translate *to*.
|
||||
sess.opts.real_rust_source_base_dir.is_some()
|
||||
// Some tests need the translation to be always skipped.
|
||||
&& sess.opts.debugging_opts.translate_remapped_path_to_local_path
|
||||
&& sess.opts.unstable_opts.translate_remapped_path_to_local_path
|
||||
})
|
||||
.flatten()
|
||||
.filter(|virtual_dir| {
|
||||
@ -1584,7 +1584,7 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
||||
// `try_to_translate_virtual_to_real` don't have to worry about how the
|
||||
// compiler is bootstrapped.
|
||||
if let Some(virtual_dir) =
|
||||
&sess.opts.debugging_opts.simulate_remapped_rust_src_base
|
||||
&sess.opts.unstable_opts.simulate_remapped_rust_src_base
|
||||
{
|
||||
if let Some(real_dir) = &sess.opts.real_rust_source_base_dir {
|
||||
if let rustc_span::FileName::Real(ref mut old_name) = name {
|
||||
|
@ -665,7 +665,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
hash: tcx.crate_hash(LOCAL_CRATE),
|
||||
stable_crate_id: tcx.def_path_hash(LOCAL_CRATE.as_def_id()).stable_crate_id(),
|
||||
required_panic_strategy: tcx.required_panic_strategy(LOCAL_CRATE),
|
||||
panic_in_drop_strategy: tcx.sess.opts.debugging_opts.panic_in_drop,
|
||||
panic_in_drop_strategy: tcx.sess.opts.unstable_opts.panic_in_drop,
|
||||
edition: tcx.sess.edition(),
|
||||
has_global_allocator: tcx.has_global_allocator(LOCAL_CRATE),
|
||||
has_panic_handler: tcx.has_panic_handler(LOCAL_CRATE),
|
||||
@ -862,7 +862,7 @@ fn should_encode_mir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> (bool, bool) {
|
||||
// Constructors
|
||||
DefKind::Ctor(_, _) => {
|
||||
let mir_opt_base = tcx.sess.opts.output_types.should_codegen()
|
||||
|| tcx.sess.opts.debugging_opts.always_encode_mir;
|
||||
|| tcx.sess.opts.unstable_opts.always_encode_mir;
|
||||
(true, mir_opt_base)
|
||||
}
|
||||
// Constants
|
||||
@ -880,7 +880,7 @@ fn should_encode_mir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> (bool, bool) {
|
||||
// The function has a `const` modifier or is in a `#[const_trait]`.
|
||||
let is_const_fn = tcx.is_const_fn_raw(def_id.to_def_id())
|
||||
|| tcx.is_const_default_method(def_id.to_def_id());
|
||||
let always_encode_mir = tcx.sess.opts.debugging_opts.always_encode_mir;
|
||||
let always_encode_mir = tcx.sess.opts.unstable_opts.always_encode_mir;
|
||||
(is_const_fn, needs_inline || always_encode_mir)
|
||||
}
|
||||
// Closures can't be const fn.
|
||||
@ -889,7 +889,7 @@ fn should_encode_mir(tcx: TyCtxt<'_>, def_id: LocalDefId) -> (bool, bool) {
|
||||
let needs_inline = (generics.requires_monomorphization(tcx)
|
||||
|| tcx.codegen_fn_attrs(def_id).requests_inline())
|
||||
&& tcx.sess.opts.output_types.should_codegen();
|
||||
let always_encode_mir = tcx.sess.opts.debugging_opts.always_encode_mir;
|
||||
let always_encode_mir = tcx.sess.opts.unstable_opts.always_encode_mir;
|
||||
(false, needs_inline || always_encode_mir)
|
||||
}
|
||||
// Generators require optimized MIR to compute layout.
|
||||
@ -1360,7 +1360,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
|
||||
// The query lookup can take a measurable amount of time in crates with many items. Check if
|
||||
// the stability attributes are even enabled before using their queries.
|
||||
if self.feat.staged_api || self.tcx.sess.opts.debugging_opts.force_unstable_if_unmarked {
|
||||
if self.feat.staged_api || self.tcx.sess.opts.unstable_opts.force_unstable_if_unmarked {
|
||||
if let Some(stab) = self.tcx.lookup_stability(def_id) {
|
||||
record!(self.tables.lookup_stability[def_id] <- stab)
|
||||
}
|
||||
@ -1372,7 +1372,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||
|
||||
// The query lookup can take a measurable amount of time in crates with many items. Check if
|
||||
// the stability attributes are even enabled before using their queries.
|
||||
if self.feat.staged_api || self.tcx.sess.opts.debugging_opts.force_unstable_if_unmarked {
|
||||
if self.feat.staged_api || self.tcx.sess.opts.unstable_opts.force_unstable_if_unmarked {
|
||||
if let Some(stab) = self.tcx.lookup_const_stability(def_id) {
|
||||
record!(self.tables.lookup_const_stability[def_id] <- stab)
|
||||
}
|
||||
|
@ -1149,7 +1149,7 @@ pub(super) fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
|
||||
hir_body_hash.hash_stable(&mut hcx, &mut stable_hasher);
|
||||
upstream_crates.hash_stable(&mut hcx, &mut stable_hasher);
|
||||
source_file_names.hash_stable(&mut hcx, &mut stable_hasher);
|
||||
if tcx.sess.opts.debugging_opts.incremental_relative_spans {
|
||||
if tcx.sess.opts.unstable_opts.incremental_relative_spans {
|
||||
let definitions = tcx.definitions_untracked();
|
||||
let mut owner_spans: Vec<_> = krate
|
||||
.owners
|
||||
|
@ -300,7 +300,7 @@ pub fn struct_lint_level<'s, 'd>(
|
||||
|
||||
let has_future_breakage = future_incompatible.map_or(
|
||||
// Default allow lints trigger too often for testing.
|
||||
sess.opts.debugging_opts.future_incompat_test && lint.default_level != Level::Allow,
|
||||
sess.opts.unstable_opts.future_incompat_test && lint.default_level != Level::Allow,
|
||||
|incompat| {
|
||||
matches!(incompat.reason, FutureIncompatibilityReason::FutureReleaseErrorReportNow)
|
||||
},
|
||||
|
@ -25,7 +25,7 @@ pub fn provide(providers: &mut ty::query::Providers) {
|
||||
tcx.hir().krate_attrs(),
|
||||
tcx.sess,
|
||||
sym::move_size_limit,
|
||||
tcx.sess.opts.debugging_opts.move_size_limit.unwrap_or(0),
|
||||
tcx.sess.opts.unstable_opts.move_size_limit.unwrap_or(0),
|
||||
),
|
||||
type_length_limit: get_limit(
|
||||
tcx.hir().krate_attrs(),
|
||||
|
@ -443,7 +443,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
// compiling a compiler crate), then let this missing feature
|
||||
// annotation slide.
|
||||
if feature == sym::rustc_private && issue == NonZeroU32::new(27812) {
|
||||
if self.sess.opts.debugging_opts.force_unstable_if_unmarked {
|
||||
if self.sess.opts.unstable_opts.force_unstable_if_unmarked {
|
||||
return EvalResult::Allow;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Grap
|
||||
let def_id = body.source.def_id();
|
||||
let def_name = graphviz_safe_def_name(def_id);
|
||||
let graph_name = format!("Mir_{}", def_name);
|
||||
let dark_mode = tcx.sess.opts.debugging_opts.graphviz_dark_mode;
|
||||
let dark_mode = tcx.sess.opts.unstable_opts.graphviz_dark_mode;
|
||||
|
||||
// Nodes
|
||||
let nodes: Vec<Node> = body
|
||||
|
@ -56,11 +56,11 @@ impl<
|
||||
writeln!(w, "{} {}{} {{", kind, cluster, self.graphviz_name)?;
|
||||
|
||||
// Global graph properties
|
||||
let font = format!(r#"fontname="{}""#, tcx.sess.opts.debugging_opts.graphviz_font);
|
||||
let font = format!(r#"fontname="{}""#, tcx.sess.opts.unstable_opts.graphviz_font);
|
||||
let mut graph_attrs = vec![&font[..]];
|
||||
let mut content_attrs = vec![&font[..]];
|
||||
|
||||
let dark_mode = tcx.sess.opts.debugging_opts.graphviz_dark_mode;
|
||||
let dark_mode = tcx.sess.opts.unstable_opts.graphviz_dark_mode;
|
||||
if dark_mode {
|
||||
graph_attrs.push(r#"bgcolor="black""#);
|
||||
graph_attrs.push(r#"fontcolor="white""#);
|
||||
|
@ -57,11 +57,11 @@ where
|
||||
W: Write,
|
||||
{
|
||||
// Global graph properties
|
||||
let font = format!(r#"fontname="{}""#, tcx.sess.opts.debugging_opts.graphviz_font);
|
||||
let font = format!(r#"fontname="{}""#, tcx.sess.opts.unstable_opts.graphviz_font);
|
||||
let mut graph_attrs = vec![&font[..]];
|
||||
let mut content_attrs = vec![&font[..]];
|
||||
|
||||
let dark_mode = tcx.sess.opts.debugging_opts.graphviz_dark_mode;
|
||||
let dark_mode = tcx.sess.opts.unstable_opts.graphviz_dark_mode;
|
||||
if dark_mode {
|
||||
graph_attrs.push(r#"bgcolor="black""#);
|
||||
graph_attrs.push(r#"fontcolor="white""#);
|
||||
|
@ -1884,7 +1884,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
||||
|
||||
// When printing regions, add trailing space if necessary.
|
||||
let print_region = ty::tls::with(|tcx| {
|
||||
tcx.sess.verbose() || tcx.sess.opts.debugging_opts.identify_regions
|
||||
tcx.sess.verbose() || tcx.sess.opts.unstable_opts.identify_regions
|
||||
});
|
||||
let region = if print_region {
|
||||
let mut region = region.to_string();
|
||||
@ -1954,7 +1954,7 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
||||
|
||||
AggregateKind::Closure(def_id, substs) => ty::tls::with(|tcx| {
|
||||
if let Some(def_id) = def_id.as_local() {
|
||||
let name = if tcx.sess.opts.debugging_opts.span_free_formats {
|
||||
let name = if tcx.sess.opts.unstable_opts.span_free_formats {
|
||||
let substs = tcx.lift(substs).unwrap();
|
||||
format!(
|
||||
"[closure@{}]",
|
||||
|
@ -90,7 +90,7 @@ impl<'tcx> MonoItem<'tcx> {
|
||||
let generate_cgu_internal_copies = tcx
|
||||
.sess
|
||||
.opts
|
||||
.debugging_opts
|
||||
.unstable_opts
|
||||
.inline_in_all_cgus
|
||||
.unwrap_or_else(|| tcx.sess.opts.optimize != OptLevel::No)
|
||||
&& !tcx.sess.link_dead_code();
|
||||
@ -459,7 +459,7 @@ impl<'tcx> CodegenUnitNameBuilder<'tcx> {
|
||||
{
|
||||
let cgu_name = self.build_cgu_name_no_mangle(cnum, components, special_suffix);
|
||||
|
||||
if self.tcx.sess.opts.debugging_opts.human_readable_cgu_names {
|
||||
if self.tcx.sess.opts.unstable_opts.human_readable_cgu_names {
|
||||
cgu_name
|
||||
} else {
|
||||
Symbol::intern(&CodegenUnit::mangle_name(cgu_name.as_str()))
|
||||
|
@ -90,7 +90,7 @@ pub fn dump_mir<'tcx, F>(
|
||||
}
|
||||
|
||||
pub fn dump_enabled<'tcx>(tcx: TyCtxt<'tcx>, pass_name: &str, def_id: DefId) -> bool {
|
||||
let Some(ref filters) = tcx.sess.opts.debugging_opts.dump_mir else {
|
||||
let Some(ref filters) = tcx.sess.opts.unstable_opts.dump_mir else {
|
||||
return false;
|
||||
};
|
||||
// see notes on #41697 below
|
||||
@ -141,7 +141,7 @@ fn dump_matched_mir_node<'tcx, F>(
|
||||
extra_data(PassWhere::AfterCFG, &mut file)?;
|
||||
};
|
||||
|
||||
if tcx.sess.opts.debugging_opts.dump_mir_graphviz {
|
||||
if tcx.sess.opts.unstable_opts.dump_mir_graphviz {
|
||||
let _: io::Result<()> = try {
|
||||
let mut file =
|
||||
create_dump_file(tcx, "dot", pass_num, pass_name, disambiguator, body.source)?;
|
||||
@ -149,7 +149,7 @@ fn dump_matched_mir_node<'tcx, F>(
|
||||
};
|
||||
}
|
||||
|
||||
if let Some(spanview) = tcx.sess.opts.debugging_opts.dump_mir_spanview {
|
||||
if let Some(spanview) = tcx.sess.opts.unstable_opts.dump_mir_spanview {
|
||||
let _: io::Result<()> = try {
|
||||
let file_basename =
|
||||
dump_file_basename(tcx, pass_num, pass_name, disambiguator, body.source);
|
||||
@ -175,7 +175,7 @@ fn dump_file_basename<'tcx>(
|
||||
None => String::new(),
|
||||
};
|
||||
|
||||
let pass_num = if tcx.sess.opts.debugging_opts.dump_mir_exclude_pass_number {
|
||||
let pass_num = if tcx.sess.opts.unstable_opts.dump_mir_exclude_pass_number {
|
||||
String::new()
|
||||
} else {
|
||||
match pass_num {
|
||||
@ -214,7 +214,7 @@ fn dump_file_basename<'tcx>(
|
||||
/// graphviz data or other things.
|
||||
fn dump_path(tcx: TyCtxt<'_>, basename: &str, extension: &str) -> PathBuf {
|
||||
let mut file_path = PathBuf::new();
|
||||
file_path.push(Path::new(&tcx.sess.opts.debugging_opts.dump_mir_dir));
|
||||
file_path.push(Path::new(&tcx.sess.opts.unstable_opts.dump_mir_dir));
|
||||
|
||||
let file_name = format!("{}.{}", basename, extension,);
|
||||
|
||||
|
@ -605,7 +605,7 @@ impl<'tcx> Instance<'tcx> {
|
||||
/// identity parameters if they are determined to be unused in `instance.def`.
|
||||
pub fn polymorphize(self, tcx: TyCtxt<'tcx>) -> Self {
|
||||
debug!("polymorphize: running polymorphization analysis");
|
||||
if !tcx.sess.opts.debugging_opts.polymorphize {
|
||||
if !tcx.sess.opts.unstable_opts.polymorphize {
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -1914,7 +1914,7 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> {
|
||||
fn record_layout_for_printing(&self, layout: TyAndLayout<'tcx>) {
|
||||
// If we are running with `-Zprint-type-sizes`, maybe record layouts
|
||||
// for dumping later.
|
||||
if self.tcx.sess.opts.debugging_opts.print_type_sizes {
|
||||
if self.tcx.sess.opts.unstable_opts.print_type_sizes {
|
||||
self.record_layout_for_printing_outlined(layout)
|
||||
}
|
||||
}
|
||||
@ -2916,7 +2916,7 @@ pub fn fn_can_unwind<'tcx>(tcx: TyCtxt<'tcx>, fn_def_id: Option<DefId>, abi: Spe
|
||||
//
|
||||
// This is not part of `codegen_fn_attrs` as it can differ between crates
|
||||
// and therefore cannot be computed in core.
|
||||
if tcx.sess.opts.debugging_opts.panic_in_drop == PanicStrategy::Abort {
|
||||
if tcx.sess.opts.unstable_opts.panic_in_drop == PanicStrategy::Abort {
|
||||
if Some(did) == tcx.lang_items().drop_in_place_fn() {
|
||||
return false;
|
||||
}
|
||||
|
@ -1761,7 +1761,7 @@ impl ReprOptions {
|
||||
// If the user defined a custom seed for layout randomization, xor the item's
|
||||
// path hash with the user defined seed, this will allowing determinism while
|
||||
// still allowing users to further randomize layout generation for e.g. fuzzing
|
||||
if let Some(user_seed) = tcx.sess.opts.debugging_opts.layout_seed {
|
||||
if let Some(user_seed) = tcx.sess.opts.unstable_opts.layout_seed {
|
||||
field_shuffle_seed ^= user_seed;
|
||||
}
|
||||
|
||||
@ -1794,7 +1794,7 @@ impl ReprOptions {
|
||||
|
||||
// If `-Z randomize-layout` was enabled for the type definition then we can
|
||||
// consider performing layout randomization
|
||||
if tcx.sess.opts.debugging_opts.randomize_layout {
|
||||
if tcx.sess.opts.unstable_opts.randomize_layout {
|
||||
flags.insert(ReprFlags::RANDOMIZE_LAYOUT);
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||
mut self,
|
||||
def_id: DefId,
|
||||
) -> Result<(Self::Path, bool), Self::Error> {
|
||||
if !self.tcx().sess.opts.debugging_opts.trim_diagnostic_paths
|
||||
if !self.tcx().sess.opts.unstable_opts.trim_diagnostic_paths
|
||||
|| matches!(self.tcx().sess.opts.trimmed_def_paths, TrimmedDefPaths::Never)
|
||||
|| NO_TRIMMED_PATH.with(|flag| flag.get())
|
||||
|| SHOULD_PREFIX_WITH_CRATE.with(|flag| flag.get())
|
||||
@ -712,7 +712,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||
p!(write("closure"));
|
||||
// FIXME(eddyb) should use `def_span`.
|
||||
if let Some(did) = did.as_local() {
|
||||
if self.tcx().sess.opts.debugging_opts.span_free_formats {
|
||||
if self.tcx().sess.opts.unstable_opts.span_free_formats {
|
||||
p!("@", print_def_path(did.to_def_id(), substs));
|
||||
} else {
|
||||
let span = self.tcx().def_span(did);
|
||||
@ -1919,7 +1919,7 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
|
||||
return true;
|
||||
}
|
||||
|
||||
let identify_regions = self.tcx.sess.opts.debugging_opts.identify_regions;
|
||||
let identify_regions = self.tcx.sess.opts.unstable_opts.identify_regions;
|
||||
|
||||
match *region {
|
||||
ty::ReEarlyBound(ref data) => {
|
||||
@ -1992,7 +1992,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
|
||||
return Ok(self);
|
||||
}
|
||||
|
||||
let identify_regions = self.tcx.sess.opts.debugging_opts.identify_regions;
|
||||
let identify_regions = self.tcx.sess.opts.unstable_opts.identify_regions;
|
||||
|
||||
// These printouts are concise. They do not contain all the information
|
||||
// the user might want to diagnose an error, but there is basically no way
|
||||
|
@ -618,7 +618,7 @@ impl UnsafeOpKind {
|
||||
|
||||
pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalDefId>) {
|
||||
// THIR unsafeck is gated under `-Z thir-unsafeck`
|
||||
if !tcx.sess.opts.debugging_opts.thir_unsafeck {
|
||||
if !tcx.sess.opts.unstable_opts.thir_unsafeck {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,7 @@ where
|
||||
io::BufWriter::new(fs::File::create(&path)?)
|
||||
}
|
||||
|
||||
None if tcx.sess.opts.debugging_opts.dump_mir_dataflow
|
||||
None if tcx.sess.opts.unstable_opts.dump_mir_dataflow
|
||||
&& dump_enabled(tcx, A::NAME, def_id) =>
|
||||
{
|
||||
create_dump_file(
|
||||
@ -314,8 +314,8 @@ where
|
||||
|
||||
let graphviz = graphviz::Formatter::new(body, results, style);
|
||||
let mut render_opts =
|
||||
vec![dot::RenderOption::Fontname(tcx.sess.opts.debugging_opts.graphviz_font.clone())];
|
||||
if tcx.sess.opts.debugging_opts.graphviz_dark_mode {
|
||||
vec![dot::RenderOption::Fontname(tcx.sess.opts.unstable_opts.graphviz_font.clone())];
|
||||
if tcx.sess.opts.unstable_opts.graphviz_dark_mode {
|
||||
render_opts.push(dot::RenderOption::DarkTheme);
|
||||
}
|
||||
dot::render_opts(&graphviz, &mut buf, &render_opts)?;
|
||||
|
@ -317,7 +317,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> {
|
||||
Self::update_bits(trans, path, s)
|
||||
});
|
||||
|
||||
if !self.tcx.sess.opts.debugging_opts.precise_enum_drop_elaboration {
|
||||
if !self.tcx.sess.opts.unstable_opts.precise_enum_drop_elaboration {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -340,7 +340,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> {
|
||||
Self::update_bits(trans, path, s)
|
||||
});
|
||||
|
||||
if !self.tcx.sess.opts.debugging_opts.precise_enum_drop_elaboration {
|
||||
if !self.tcx.sess.opts.unstable_opts.precise_enum_drop_elaboration {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -379,7 +379,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeInitializedPlaces<'_, 'tcx> {
|
||||
discr: &mir::Operand<'tcx>,
|
||||
edge_effects: &mut impl SwitchIntEdgeEffects<G>,
|
||||
) {
|
||||
if !self.tcx.sess.opts.debugging_opts.precise_enum_drop_elaboration {
|
||||
if !self.tcx.sess.opts.unstable_opts.precise_enum_drop_elaboration {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -495,7 +495,7 @@ impl<'tcx> GenKillAnalysis<'tcx> for MaybeUninitializedPlaces<'_, 'tcx> {
|
||||
discr: &mir::Operand<'tcx>,
|
||||
edge_effects: &mut impl SwitchIntEdgeEffects<G>,
|
||||
) {
|
||||
if !self.tcx.sess.opts.debugging_opts.precise_enum_drop_elaboration {
|
||||
if !self.tcx.sess.opts.unstable_opts.precise_enum_drop_elaboration {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ impl<'tcx> MirPass<'tcx> for AbortUnwindingCalls {
|
||||
layout::fn_can_unwind(tcx, fn_def_id, sig.abi())
|
||||
}
|
||||
TerminatorKind::Drop { .. } | TerminatorKind::DropAndReplace { .. } => {
|
||||
tcx.sess.opts.debugging_opts.panic_in_drop == PanicStrategy::Unwind
|
||||
tcx.sess.opts.unstable_opts.panic_in_drop == PanicStrategy::Unwind
|
||||
&& layout::fn_can_unwind(tcx, None, Abi::Rust)
|
||||
}
|
||||
TerminatorKind::Assert { .. } | TerminatorKind::FalseUnwind { .. } => {
|
||||
|
@ -72,7 +72,7 @@ fn may_contain_reference<'tcx>(ty: Ty<'tcx>, depth: u32, tcx: TyCtxt<'tcx>) -> b
|
||||
|
||||
impl<'tcx> MirPass<'tcx> for AddRetag {
|
||||
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
||||
sess.opts.debugging_opts.mir_emit_retag
|
||||
sess.opts.unstable_opts.mir_emit_retag
|
||||
}
|
||||
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
|
@ -16,7 +16,7 @@ pub struct ConstDebugInfo;
|
||||
|
||||
impl<'tcx> MirPass<'tcx> for ConstDebugInfo {
|
||||
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
||||
sess.opts.debugging_opts.unsound_mir_opts && sess.mir_opt_level() > 0
|
||||
sess.opts.unstable_opts.unsound_mir_opts && sess.mir_opt_level() > 0
|
||||
}
|
||||
|
||||
fn run_pass(&self, _tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
|
@ -160,8 +160,8 @@ impl<'a, 'tcx> Instrumentor<'a, 'tcx> {
|
||||
let mut debug_used_expressions = debug::UsedExpressions::new();
|
||||
|
||||
let dump_mir = dump_enabled(tcx, self.pass_name, def_id);
|
||||
let dump_graphviz = dump_mir && tcx.sess.opts.debugging_opts.dump_mir_graphviz;
|
||||
let dump_spanview = dump_mir && tcx.sess.opts.debugging_opts.dump_mir_spanview.is_some();
|
||||
let dump_graphviz = dump_mir && tcx.sess.opts.unstable_opts.dump_mir_graphviz;
|
||||
let dump_spanview = dump_mir && tcx.sess.opts.unstable_opts.dump_mir_spanview.is_some();
|
||||
|
||||
if dump_graphviz {
|
||||
graphviz_data.enable();
|
||||
|
@ -122,7 +122,7 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
|
||||
//
|
||||
// Only run at mir-opt-level=3 or higher for now (we don't fix up debuginfo and remove
|
||||
// storage statements at the moment).
|
||||
sess.opts.debugging_opts.unsound_mir_opts && sess.mir_opt_level() >= 3
|
||||
sess.opts.unstable_opts.unsound_mir_opts && sess.mir_opt_level() >= 3
|
||||
}
|
||||
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
|
@ -95,7 +95,7 @@ pub struct EarlyOtherwiseBranch;
|
||||
|
||||
impl<'tcx> MirPass<'tcx> for EarlyOtherwiseBranch {
|
||||
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
||||
sess.mir_opt_level() >= 3 && sess.opts.debugging_opts.unsound_mir_opts
|
||||
sess.mir_opt_level() >= 3 && sess.opts.unstable_opts.unsound_mir_opts
|
||||
}
|
||||
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
|
@ -957,7 +957,7 @@ fn create_generator_drop_shim<'tcx>(
|
||||
tcx.mk_ptr(ty::TypeAndMut { ty: gen_ty, mutbl: hir::Mutability::Mut }),
|
||||
source_info,
|
||||
);
|
||||
if tcx.sess.opts.debugging_opts.mir_emit_retag {
|
||||
if tcx.sess.opts.unstable_opts.mir_emit_retag {
|
||||
// Alias tracking must know we changed the type
|
||||
body.basic_blocks_mut()[START_BLOCK].statements.insert(
|
||||
0,
|
||||
@ -1386,7 +1386,7 @@ impl<'tcx> MirPass<'tcx> for StateTransform {
|
||||
|
||||
sanitize_witness(tcx, body, interior, upvars, &liveness_info.saved_locals);
|
||||
|
||||
if tcx.sess.opts.debugging_opts.validate_mir {
|
||||
if tcx.sess.opts.unstable_opts.validate_mir {
|
||||
let mut vis = EnsureGeneratorFieldAssignmentsNeverAlias {
|
||||
assigned_local: None,
|
||||
saved_locals: &liveness_info.saved_locals,
|
||||
|
@ -40,7 +40,7 @@ struct CallSite<'tcx> {
|
||||
|
||||
impl<'tcx> MirPass<'tcx> for Inline {
|
||||
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
|
||||
if let Some(enabled) = sess.opts.debugging_opts.inline_mir {
|
||||
if let Some(enabled) = sess.opts.unstable_opts.inline_mir {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@ -395,9 +395,9 @@ impl<'tcx> Inliner<'tcx> {
|
||||
let tcx = self.tcx;
|
||||
|
||||
let mut threshold = if callee_attrs.requests_inline() {
|
||||
self.tcx.sess.opts.debugging_opts.inline_mir_hint_threshold.unwrap_or(100)
|
||||
self.tcx.sess.opts.unstable_opts.inline_mir_hint_threshold.unwrap_or(100)
|
||||
} else {
|
||||
self.tcx.sess.opts.debugging_opts.inline_mir_threshold.unwrap_or(50)
|
||||
self.tcx.sess.opts.unstable_opts.inline_mir_threshold.unwrap_or(50)
|
||||
};
|
||||
|
||||
// Give a bonus functions with a small number of blocks,
|
||||
|
@ -217,7 +217,7 @@ fn mir_const<'tcx>(
|
||||
}
|
||||
|
||||
// Unsafety check uses the raw mir, so make sure it is run.
|
||||
if !tcx.sess.opts.debugging_opts.thir_unsafeck {
|
||||
if !tcx.sess.opts.unstable_opts.thir_unsafeck {
|
||||
if let Some(param_did) = def.const_param_did {
|
||||
tcx.ensure().unsafety_check_result_for_const_arg((def.did, param_did));
|
||||
} else {
|
||||
|
@ -76,8 +76,8 @@ pub fn run_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>, passes: &[&dyn
|
||||
let start_phase = body.phase;
|
||||
let mut cnt = 0;
|
||||
|
||||
let validate = tcx.sess.opts.debugging_opts.validate_mir;
|
||||
let overridden_passes = &tcx.sess.opts.debugging_opts.mir_enable_passes;
|
||||
let validate = tcx.sess.opts.unstable_opts.validate_mir;
|
||||
let overridden_passes = &tcx.sess.opts.unstable_opts.mir_enable_passes;
|
||||
trace!(?overridden_passes);
|
||||
|
||||
if validate {
|
||||
|
@ -176,7 +176,7 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, ty: Option<Ty<'tcx>>)
|
||||
if ty.is_some() {
|
||||
// The first argument (index 0), but add 1 for the return value.
|
||||
let dropee_ptr = Place::from(Local::new(1 + 0));
|
||||
if tcx.sess.opts.debugging_opts.mir_emit_retag {
|
||||
if tcx.sess.opts.unstable_opts.mir_emit_retag {
|
||||
// Function arguments should be retagged, and we make this one raw.
|
||||
body.basic_blocks_mut()[START_BLOCK].statements.insert(
|
||||
0,
|
||||
|
@ -378,7 +378,7 @@ fn optimization_applies<'tcx>(
|
||||
impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
// FIXME(77359): This optimization can result in unsoundness.
|
||||
if !tcx.sess.opts.debugging_opts.unsound_mir_opts {
|
||||
if !tcx.sess.opts.unstable_opts.unsound_mir_opts {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -551,7 +551,7 @@ impl<'tcx> MirPass<'tcx> for SimplifyBranchSame {
|
||||
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
// This optimization is disabled by default for now due to
|
||||
// soundness concerns; see issue #89485 and PR #89489.
|
||||
if !tcx.sess.opts.debugging_opts.unsound_mir_opts {
|
||||
if !tcx.sess.opts.unstable_opts.unsound_mir_opts {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1141,8 +1141,7 @@ fn create_fn_mono_item<'tcx>(
|
||||
debug!("create_fn_mono_item(instance={})", instance);
|
||||
|
||||
let def_id = instance.def_id();
|
||||
if tcx.sess.opts.debugging_opts.profile_closures && def_id.is_local() && tcx.is_closure(def_id)
|
||||
{
|
||||
if tcx.sess.opts.unstable_opts.profile_closures && def_id.is_local() && tcx.is_closure(def_id) {
|
||||
crate::util::dump_closure_profile(tcx, instance);
|
||||
}
|
||||
|
||||
|
@ -303,7 +303,7 @@ fn characteristic_def_id_of_mono_item<'tcx>(
|
||||
|
||||
// When polymorphization is enabled, methods which do not depend on their generic
|
||||
// parameters, but the self-type of their impl block do will fail to normalize.
|
||||
if !tcx.sess.opts.debugging_opts.polymorphize || !instance.needs_subst() {
|
||||
if !tcx.sess.opts.unstable_opts.polymorphize || !instance.needs_subst() {
|
||||
// This is a method within an impl, find out what the self-type is:
|
||||
let impl_self_ty = tcx.subst_and_normalize_erasing_regions(
|
||||
instance.substs,
|
||||
|
@ -83,7 +83,7 @@ pub fn merge_codegen_units<'tcx>(
|
||||
|
||||
for cgu in codegen_units.iter_mut() {
|
||||
if let Some(new_cgu_name) = new_cgu_names.get(&cgu.name()) {
|
||||
if cx.tcx.sess.opts.debugging_opts.human_readable_cgu_names {
|
||||
if cx.tcx.sess.opts.unstable_opts.human_readable_cgu_names {
|
||||
cgu.set_name(Symbol::intern(&new_cgu_name));
|
||||
} else {
|
||||
// If we don't require CGU names to be human-readable, we
|
||||
|
@ -141,7 +141,7 @@ trait Partitioner<'tcx> {
|
||||
}
|
||||
|
||||
fn get_partitioner<'tcx>(tcx: TyCtxt<'tcx>) -> Box<dyn Partitioner<'tcx>> {
|
||||
let strategy = match &tcx.sess.opts.debugging_opts.cgu_partitioning_strategy {
|
||||
let strategy = match &tcx.sess.opts.unstable_opts.cgu_partitioning_strategy {
|
||||
None => "default",
|
||||
Some(s) => &s[..],
|
||||
};
|
||||
@ -345,7 +345,7 @@ fn collect_and_partition_mono_items<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
(): (),
|
||||
) -> (&'tcx DefIdSet, &'tcx [CodegenUnit<'tcx>]) {
|
||||
let collection_mode = match tcx.sess.opts.debugging_opts.print_mono_items {
|
||||
let collection_mode = match tcx.sess.opts.unstable_opts.print_mono_items {
|
||||
Some(ref s) => {
|
||||
let mode_string = s.to_lowercase();
|
||||
let mode_string = mode_string.trim();
|
||||
@ -413,7 +413,7 @@ fn collect_and_partition_mono_items<'tcx>(
|
||||
})
|
||||
.collect();
|
||||
|
||||
if tcx.sess.opts.debugging_opts.print_mono_items.is_some() {
|
||||
if tcx.sess.opts.unstable_opts.print_mono_items.is_some() {
|
||||
let mut item_to_cgus: FxHashMap<_, Vec<_>> = Default::default();
|
||||
|
||||
for cgu in codegen_units {
|
||||
|
@ -36,7 +36,7 @@ fn unused_generic_params<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
instance: ty::InstanceDef<'tcx>,
|
||||
) -> FiniteBitSet<u32> {
|
||||
if !tcx.sess.opts.debugging_opts.polymorphize {
|
||||
if !tcx.sess.opts.unstable_opts.polymorphize {
|
||||
// If polymorphization disabled, then all parameters are used.
|
||||
return FiniteBitSet::new_empty();
|
||||
}
|
||||
|
@ -1625,7 +1625,7 @@ impl CheckAttrVisitor<'_> {
|
||||
/// Checks that the dep-graph debugging attributes are only present when the query-dep-graph
|
||||
/// option is passed to the compiler.
|
||||
fn check_rustc_dirty_clean(&self, attr: &Attribute) -> bool {
|
||||
if self.tcx.sess.opts.debugging_opts.query_dep_graph {
|
||||
if self.tcx.sess.opts.unstable_opts.query_dep_graph {
|
||||
true
|
||||
} else {
|
||||
self.tcx
|
||||
|
@ -122,7 +122,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
|
||||
// `-Zunleash-the-miri-inside-of-you` only works for expressions that don't have a
|
||||
// corresponding feature gate. This encourages nightly users to use feature gates when
|
||||
// possible.
|
||||
None if tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you => {
|
||||
None if tcx.sess.opts.unstable_opts.unleash_the_miri_inside_of_you => {
|
||||
tcx.sess.span_warn(span, "skipping const checks");
|
||||
return;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use rustc_middle::ty::TyCtxt;
|
||||
pub fn check_crate(tcx: TyCtxt<'_>) {
|
||||
tcx.dep_graph.assert_ignored();
|
||||
|
||||
if tcx.sess.opts.debugging_opts.hir_stats {
|
||||
if tcx.sess.opts.unstable_opts.hir_stats {
|
||||
crate::hir_stats::print_hir_stats(tcx);
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,7 @@ fn stability_index(tcx: TyCtxt<'_>, (): ()) -> Index {
|
||||
// compiling `librustc_*` crates themselves so we can leverage crates.io
|
||||
// while maintaining the invariant that all sysroot crates are unstable
|
||||
// by default and are unable to be used.
|
||||
if tcx.sess.opts.debugging_opts.force_unstable_if_unmarked {
|
||||
if tcx.sess.opts.unstable_opts.force_unstable_if_unmarked {
|
||||
let reason = "this crate is being loaded from the sysroot, an \
|
||||
unstable location; did you mean to load this crate \
|
||||
from crates.io via `Cargo.toml` instead?";
|
||||
@ -850,7 +850,7 @@ impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
|
||||
/// libraries, identify activated features that don't exist and error about them.
|
||||
pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
|
||||
let is_staged_api =
|
||||
tcx.sess.opts.debugging_opts.force_unstable_if_unmarked || tcx.features().staged_api;
|
||||
tcx.sess.opts.unstable_opts.force_unstable_if_unmarked || tcx.features().staged_api;
|
||||
if is_staged_api {
|
||||
let access_levels = &tcx.privacy_access_levels(());
|
||||
let mut missing = MissingStabilityAnnotations { tcx, access_levels };
|
||||
|
@ -79,8 +79,8 @@ impl<K: DepKind> DepNode<K> {
|
||||
#[cfg(debug_assertions)]
|
||||
{
|
||||
if !tcx.fingerprint_style(kind).reconstructible()
|
||||
&& (tcx.sess().opts.debugging_opts.incremental_info
|
||||
|| tcx.sess().opts.debugging_opts.query_dep_graph)
|
||||
&& (tcx.sess().opts.unstable_opts.incremental_info
|
||||
|| tcx.sess().opts.unstable_opts.query_dep_graph)
|
||||
{
|
||||
tcx.dep_graph().register_dep_node_debug_str(dep_node, || arg.to_debug_str(tcx));
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ impl<K: DepKind> DepGraph<K> {
|
||||
let current_fingerprint =
|
||||
hash_result.map(|f| dcx.with_stable_hashing_context(|mut hcx| f(&mut hcx, &result)));
|
||||
|
||||
let print_status = cfg!(debug_assertions) && dcx.sess().opts.debugging_opts.dep_tasks;
|
||||
let print_status = cfg!(debug_assertions) && dcx.sess().opts.unstable_opts.dep_tasks;
|
||||
|
||||
// Intern the new `DepNode`.
|
||||
let (dep_node_index, prev_and_color) = data.current.intern_node(
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user