Rollup merge of #66850 - eddyb:span-free-formats, r=oli-obk
rustc: hide HirId's fmt::Debug output from -Z span_free_formats. This replaces the only occurrences of `HirId {...}` from tests with paths, i.e.: ```rust [closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T] ``` becomes, after this PR: ```rust [closure@foo<T>::{{closure}}#0 q:&i32, t:&T] ``` r? @oli-obk cc @michaelwoerister
This commit is contained in:
commit
dbe880e8ec
6 changed files with 17 additions and 13 deletions
|
@ -2313,10 +2313,14 @@ impl<'tcx> Debug for Rvalue<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AggregateKind::Closure(def_id, _) => ty::tls::with(|tcx| {
|
AggregateKind::Closure(def_id, substs) => ty::tls::with(|tcx| {
|
||||||
if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) {
|
if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) {
|
||||||
let name = if tcx.sess.opts.debugging_opts.span_free_formats {
|
let name = if tcx.sess.opts.debugging_opts.span_free_formats {
|
||||||
format!("[closure@{:?}]", hir_id)
|
let substs = tcx.lift(&substs).unwrap();
|
||||||
|
format!(
|
||||||
|
"[closure@{}]",
|
||||||
|
tcx.def_path_str_with_substs(def_id, substs),
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
format!("[closure@{:?}]", tcx.hir().span(hir_id))
|
format!("[closure@{:?}]", tcx.hir().span(hir_id))
|
||||||
};
|
};
|
||||||
|
|
|
@ -682,7 +682,7 @@ pub trait PrettyPrinter<'tcx>:
|
||||||
// FIXME(eddyb) should use `def_span`.
|
// FIXME(eddyb) should use `def_span`.
|
||||||
if let Some(hir_id) = self.tcx().hir().as_local_hir_id(did) {
|
if let Some(hir_id) = self.tcx().hir().as_local_hir_id(did) {
|
||||||
if self.tcx().sess.opts.debugging_opts.span_free_formats {
|
if self.tcx().sess.opts.debugging_opts.span_free_formats {
|
||||||
p!(write("@{:?}", hir_id));
|
p!(write("@"), print_def_path(did, substs));
|
||||||
} else {
|
} else {
|
||||||
p!(write("@{:?}", self.tcx().hir().span(hir_id)));
|
p!(write("@{:?}", self.tcx().hir().span(hir_id)));
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
|
||||||
// debug _t => _1;
|
// debug _t => _1;
|
||||||
// debug q => _2;
|
// debug q => _2;
|
||||||
// let mut _0: i32;
|
// let mut _0: i32;
|
||||||
// let _3: [closure@HirId { owner: DefIndex(4), local_id: 31 }];
|
// let _3: [closure@foo<T>::{{closure}}#0];
|
||||||
// let mut _4: &[closure@HirId { owner: DefIndex(4), local_id: 31 }];
|
// let mut _4: &[closure@foo<T>::{{closure}}#0];
|
||||||
// let mut _5: (&i32, &i32);
|
// let mut _5: (&i32, &i32);
|
||||||
// let mut _6: &i32;
|
// let mut _6: &i32;
|
||||||
// let mut _7: &i32;
|
// let mut _7: &i32;
|
||||||
|
@ -40,7 +40,7 @@ fn foo<T: Copy>(_t: T, q: &i32) -> i32 {
|
||||||
// }
|
// }
|
||||||
// bb0: {
|
// bb0: {
|
||||||
// ...
|
// ...
|
||||||
// _3 = [closure@HirId { owner: DefIndex(4), local_id: 31 }];
|
// _3 = [closure@foo::<T>::{{closure}}#0];
|
||||||
// ...
|
// ...
|
||||||
// _4 = &_3;
|
// _4 = &_3;
|
||||||
// ...
|
// ...
|
||||||
|
|
|
@ -17,10 +17,10 @@ fn foo<T: Copy>(t: T, q: i32) -> (i32, T) {
|
||||||
// debug t => _1;
|
// debug t => _1;
|
||||||
// debug q => _2;
|
// debug q => _2;
|
||||||
// let mut _0: (i32, T);
|
// let mut _0: (i32, T);
|
||||||
// let _3: [closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T];
|
// let _3: [closure@foo<T>::{{closure}}#0 q:&i32, t:&T];
|
||||||
// let mut _4: &i32;
|
// let mut _4: &i32;
|
||||||
// let mut _5: &T;
|
// let mut _5: &T;
|
||||||
// let mut _6: &[closure@HirId { owner: DefIndex(4), local_id: 15 } q:&i32, t:&T];
|
// let mut _6: &[closure@foo<T>::{{closure}}#0 q:&i32, t:&T];
|
||||||
// let mut _7: (i32,);
|
// let mut _7: (i32,);
|
||||||
// let mut _8: i32;
|
// let mut _8: i32;
|
||||||
// let mut _11: i32;
|
// let mut _11: i32;
|
||||||
|
@ -39,7 +39,7 @@ fn foo<T: Copy>(t: T, q: i32) -> (i32, T) {
|
||||||
// _4 = &_2;
|
// _4 = &_2;
|
||||||
// ...
|
// ...
|
||||||
// _5 = &_1;
|
// _5 = &_1;
|
||||||
// _3 = [closure@HirId { owner: DefIndex(4), local_id: 15 }] { q: move _4, t: move _5 };
|
// _3 = [closure@foo::<T>::{{closure}}#0] { q: move _4, t: move _5 };
|
||||||
// ...
|
// ...
|
||||||
// _6 = &_3;
|
// _6 = &_3;
|
||||||
// ...
|
// ...
|
||||||
|
|
|
@ -17,8 +17,8 @@ fn foo<T: Copy>(_t: T, q: i32) -> i32 {
|
||||||
// debug _t => _1;
|
// debug _t => _1;
|
||||||
// debug q => _2;
|
// debug q => _2;
|
||||||
// let mut _0: i32;
|
// let mut _0: i32;
|
||||||
// let _3: [closure@HirId { owner: DefIndex(4), local_id: 15 }];
|
// let _3: [closure@foo<T>::{{closure}}#0];
|
||||||
// let mut _4: &[closure@HirId { owner: DefIndex(4), local_id: 15 }];
|
// let mut _4: &[closure@foo<T>::{{closure}}#0];
|
||||||
// let mut _5: (i32, i32);
|
// let mut _5: (i32, i32);
|
||||||
// let mut _6: i32;
|
// let mut _6: i32;
|
||||||
// let mut _7: i32;
|
// let mut _7: i32;
|
||||||
|
@ -33,7 +33,7 @@ fn foo<T: Copy>(_t: T, q: i32) -> i32 {
|
||||||
// }
|
// }
|
||||||
// bb0: {
|
// bb0: {
|
||||||
// ...
|
// ...
|
||||||
// _3 = [closure@HirId { owner: DefIndex(4), local_id: 15 }];
|
// _3 = [closure@foo::<T>::{{closure}}#0];
|
||||||
// ...
|
// ...
|
||||||
// _4 = &_3;
|
// _4 = &_3;
|
||||||
// ...
|
// ...
|
||||||
|
|
|
@ -100,7 +100,7 @@ fn main() {
|
||||||
// }
|
// }
|
||||||
// END rustc.main.EraseRegions.after.mir
|
// END rustc.main.EraseRegions.after.mir
|
||||||
// START rustc.main-{{closure}}.EraseRegions.after.mir
|
// START rustc.main-{{closure}}.EraseRegions.after.mir
|
||||||
// fn main::{{closure}}#0(_1: &[closure@HirId { owner: DefIndex(13), local_id: 72 }], _2: &i32) -> &i32 {
|
// fn main::{{closure}}#0(_1: &[closure@main::{{closure}}#0], _2: &i32) -> &i32 {
|
||||||
// ...
|
// ...
|
||||||
// bb0: {
|
// bb0: {
|
||||||
// Retag([fn entry] _1);
|
// Retag([fn entry] _1);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue