Fix pretty hir for anon consts in diagnostics

This commit is contained in:
Michael Goulet 2024-04-14 10:26:59 -04:00
parent 3493a56529
commit 619e044178
13 changed files with 32 additions and 41 deletions

View file

@ -24,20 +24,6 @@ struct AstNoAnn;
impl pprust_ast::PpAnn for AstNoAnn {}
struct HirNoAnn<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl<'tcx> pprust_hir::PpAnn for HirNoAnn<'tcx> {
fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
pprust_hir::PpAnn::nested(
&(&self.tcx.hir() as &dyn hir::intravisit::Map<'_>),
state,
nested,
)
}
}
struct AstIdentifiedAnn;
impl pprust_ast::PpAnn for AstIdentifiedAnn {
@ -300,10 +286,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
)
};
match s {
PpHirMode::Normal => {
let annotation = HirNoAnn { tcx };
f(&annotation)
}
PpHirMode::Normal => f(&tcx),
PpHirMode::Identified => {
let annotation = HirIdentifiedAnn { tcx };
f(&annotation)