Don't cause a cycle when formatting query description that references a FnDef

This commit is contained in:
Michael Goulet 2023-02-02 05:49:07 +00:00
parent e63ec2e140
commit 64f5293956
7 changed files with 51 additions and 20 deletions

View file

@ -314,11 +314,14 @@ pub(crate) fn create_query_frame<
kind: DepKind,
name: &'static str,
) -> QueryStackFrame<DepKind> {
// Disable visible paths printing for performance reasons.
// Showing visible path instead of any path is not that important in production.
let description = ty::print::with_no_visible_paths!(
// Force filename-line mode to avoid invoking `type_of` query.
ty::print::with_forced_impl_filename_line!(do_describe(tcx.tcx, key))
// Avoid calling queries while formatting the description
let description = ty::print::with_no_queries!(
// Disable visible paths printing for performance reasons.
// Showing visible path instead of any path is not that important in production.
ty::print::with_no_visible_paths!(
// Force filename-line mode to avoid invoking `type_of` query.
ty::print::with_forced_impl_filename_line!(do_describe(tcx.tcx, key))
)
);
let description =
if tcx.sess.verbose() { format!("{description} [{name:?}]") } else { description };