Rollup merge of #127181 - BoxyUwU:dump_def_parents, r=compiler-errors

Introduce a `rustc_` attribute to dump all the `DefId` parents of a `DefId`

We've run into a bunch of issues with anon consts having the wrong generics and it would have been incredibly helpful to be able to quickly slap a `rustc_` attribute to check what `tcx.parent(` will return on the relevant DefIds.

I wasn't sure of a better way to make this work for anon consts than requiring the attribute to be on the enclosing item and then walking the inside of it to look for any anon consts. This particular method will honestly break at some point when we stop having a `DefId` available for anon consts in hir but that's for another day...

r? ``@compiler-errors``
This commit is contained in:
Matthias Krüger
2024-07-01 08:53:07 +02:00
committed by GitHub
6 changed files with 217 additions and 1 deletions

View File

@@ -175,6 +175,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
tcx.sess.time("variance_dumping", || variance::dump::variances(tcx));
collect::dump::opaque_hidden_types(tcx);
collect::dump::predicates_and_item_bounds(tcx);
collect::dump::def_parents(tcx);
}
// Make sure we evaluate all static and (non-associated) const items, even if unused.