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:
bors 2022-07-14 08:14:31 +00:00
commit 0ed9c64c3e
125 changed files with 396 additions and 394 deletions

View file

@ -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 { .. } => {

View file

@ -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>) {

View file

@ -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>) {

View file

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

View file

@ -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>) {

View file

@ -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>) {

View file

@ -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,

View file

@ -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,

View file

@ -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 {

View file

@ -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 {

View file

@ -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,

View file

@ -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;
}