Rename some 'hir lifetimes as 'tcx.

Because they all end up within a `TyCtxt`.
This commit is contained in:
Nicholas Nethercote 2023-10-11 08:58:27 +11:00
parent 060851b764
commit ba58e3213d

View File

@ -19,12 +19,12 @@
pub use self::PpSourceMode::*; pub use self::PpSourceMode::*;
use crate::abort_on_err; use crate::abort_on_err;
struct NoAnn<'hir> { struct NoAnn<'tcx> {
tcx: Option<TyCtxt<'hir>>, tcx: Option<TyCtxt<'tcx>>,
} }
impl<'hir> pprust_ast::PpAnn for NoAnn<'hir> {} impl<'tcx> pprust_ast::PpAnn for NoAnn<'tcx> {}
impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> { impl<'tcx> pprust_hir::PpAnn for NoAnn<'tcx> {
fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) { fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
if let Some(tcx) = self.tcx { if let Some(tcx) = self.tcx {
pprust_hir::PpAnn::nested(&(&tcx.hir() as &dyn hir::intravisit::Map<'_>), state, nested) pprust_hir::PpAnn::nested(&(&tcx.hir() as &dyn hir::intravisit::Map<'_>), state, nested)
@ -32,11 +32,11 @@ fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested)
} }
} }
struct IdentifiedAnnotation<'hir> { struct IdentifiedAnnotation<'tcx> {
tcx: Option<TyCtxt<'hir>>, tcx: Option<TyCtxt<'tcx>>,
} }
impl<'hir> pprust_ast::PpAnn for IdentifiedAnnotation<'hir> { impl<'tcx> pprust_ast::PpAnn for IdentifiedAnnotation<'tcx> {
fn pre(&self, s: &mut pprust_ast::State<'_>, node: pprust_ast::AnnNode<'_>) { fn pre(&self, s: &mut pprust_ast::State<'_>, node: pprust_ast::AnnNode<'_>) {
if let pprust_ast::AnnNode::Expr(_) = node { if let pprust_ast::AnnNode::Expr(_) = node {
s.popen(); s.popen();
@ -74,7 +74,7 @@ fn post(&self, s: &mut pprust_ast::State<'_>, node: pprust_ast::AnnNode<'_>) {
} }
} }
impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { impl<'tcx> pprust_hir::PpAnn for IdentifiedAnnotation<'tcx> {
fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) { fn nested(&self, state: &mut pprust_hir::State<'_>, nested: pprust_hir::Nested) {
if let Some(ref tcx) = self.tcx { if let Some(ref tcx) = self.tcx {
pprust_hir::PpAnn::nested(&(&tcx.hir() as &dyn hir::intravisit::Map<'_>), state, nested) pprust_hir::PpAnn::nested(&(&tcx.hir() as &dyn hir::intravisit::Map<'_>), state, nested)