Add #[rustc_dump_{predicates,item_bounds}]
This commit is contained in:
parent
bc12972bcd
commit
38bd7a0fcb
6 changed files with 95 additions and 0 deletions
|
@ -16,3 +16,28 @@ pub(crate) fn opaque_hidden_types(tcx: TyCtxt<'_>) {
|
|||
tcx.dcx().emit_err(crate::errors::TypeOf { span: tcx.def_span(id.owner_id), ty });
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn predicates_and_item_bounds(tcx: TyCtxt<'_>) {
|
||||
for id in tcx.hir_crate_items(()).owners() {
|
||||
if tcx.has_attr(id, sym::rustc_dump_predicates) {
|
||||
let preds = tcx.predicates_of(id).instantiate_identity(tcx).predicates;
|
||||
let span = tcx.def_span(id);
|
||||
|
||||
let mut diag = tcx.dcx().struct_span_err(span, sym::rustc_dump_predicates.as_str());
|
||||
for pred in preds {
|
||||
diag.note(format!("{pred:?}"));
|
||||
}
|
||||
diag.emit();
|
||||
}
|
||||
if tcx.has_attr(id, sym::rustc_dump_item_bounds) {
|
||||
let bounds = tcx.item_bounds(id).instantiate_identity();
|
||||
let span = tcx.def_span(id);
|
||||
|
||||
let mut diag = tcx.dcx().struct_span_err(span, sym::rustc_dump_item_bounds.as_str());
|
||||
for bound in bounds {
|
||||
diag.note(format!("{bound:?}"));
|
||||
}
|
||||
diag.emit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,6 +168,7 @@ pub fn check_crate(tcx: TyCtxt<'_>) {
|
|||
tcx.sess.time("outlives_dumping", || outlives::dump::inferred_outlives(tcx));
|
||||
tcx.sess.time("variance_dumping", || variance::dump::variances(tcx));
|
||||
collect::dump::opaque_hidden_types(tcx);
|
||||
collect::dump::predicates_and_item_bounds(tcx);
|
||||
}
|
||||
|
||||
// Make sure we evaluate all static and (non-associated) const items, even if unused.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue