Add `-Z span_free_rvalues`.
This is solely a hack to make comparing test output plausible; it makes closures print as [closure@node_id] instead of [closure@span-with-host-path] in debug printouts.
This commit is contained in:
parent
54eeef14a3
commit
20df0e9491
|
@ -1224,7 +1224,11 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
|||
|
||||
AggregateKind::Closure(def_id, _) => ty::tls::with(|tcx| {
|
||||
if let Some(node_id) = tcx.hir.as_local_node_id(def_id) {
|
||||
let name = format!("[closure@{:?}]", tcx.hir.span(node_id));
|
||||
let name = if tcx.sess.opts.debugging_opts.span_free_formats {
|
||||
format!("[closure@{:?}]", node_id)
|
||||
} else {
|
||||
format!("[closure@{:?}]", tcx.hir.span(node_id))
|
||||
};
|
||||
let mut struct_fmt = fmt.debug_struct(&name);
|
||||
|
||||
tcx.with_freevars(node_id, |freevars| {
|
||||
|
|
|
@ -893,6 +893,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
|||
DB_OPTIONS, db_type_desc, dbsetters,
|
||||
verbose: bool = (false, parse_bool, [UNTRACKED],
|
||||
"in general, enable more debug printouts"),
|
||||
span_free_formats: bool = (false, parse_bool, [UNTRACKED],
|
||||
"when debug-printing compiler state, do not include spans"), // o/w tests have closure@path
|
||||
time_passes: bool = (false, parse_bool, [UNTRACKED],
|
||||
"measure time of each rustc pass"),
|
||||
count_llvm_insns: bool = (false, parse_bool,
|
||||
|
|
|
@ -789,7 +789,11 @@ impl<'tcx> fmt::Display for ty::TypeVariants<'tcx> {
|
|||
write!(f, "[closure")?;
|
||||
|
||||
if let Some(node_id) = tcx.hir.as_local_node_id(did) {
|
||||
if tcx.sess.opts.debugging_opts.span_free_formats {
|
||||
write!(f, "@{:?}", node_id)?;
|
||||
} else {
|
||||
write!(f, "@{:?}", tcx.hir.span(node_id))?;
|
||||
}
|
||||
let mut sep = " ";
|
||||
tcx.with_freevars(node_id, |freevars| {
|
||||
for (freevar, upvar_ty) in freevars.iter().zip(upvar_tys) {
|
||||
|
|
Loading…
Reference in New Issue