Skip to content

Rename debugging_opts to unstable_opts #98975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_ast_lowering/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/facts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_borrowck/src/nll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/region_infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_builtin_macros/src/test_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_cranelift/src/driver/aot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_cranelift/src/intrinsics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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)
{
Expand All @@ -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;
}

Expand Down Expand Up @@ -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"));
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/back/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
14 changes: 7 additions & 7 deletions compiler/rustc_codegen_llvm/src/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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());

Expand All @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_llvm/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -308,15 +308,15 @@ 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,
"cf-protection-branch\0".as_ptr().cast(),
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,
Expand All @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")),
Expand Down Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/debuginfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
Expand All @@ -125,19 +125,19 @@ unsafe fn configure_llvm(sess: &Session) {
}
}

if sess.opts.debugging_opts.llvm_time_trace {
if sess.opts.unstable_opts.llvm_time_trace {
llvm::LLVMTimeTraceProfilerInitialize();
}

llvm::LLVMInitializePasses();

// 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);

Expand Down Expand Up @@ -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))
}

Expand Down
Loading