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.
This commit is contained in:
Joshua Nelson
2022-07-06 07:44:47 -05:00
parent c80dde43f9
commit 3c9765cff1
125 changed files with 396 additions and 394 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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""#);

View File

@@ -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""#);

View File

@@ -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@{}]",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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