1
Fork 0

Add some comments.

This commit is contained in:
Nicholas Nethercote 2023-11-14 14:00:25 +11:00
parent 10c8b56af1
commit 9fe6bb4a10
2 changed files with 8 additions and 0 deletions

View file

@ -1,3 +1,7 @@
//! AST pretty printing.
//!
//! Note that HIR pretty printing is layered on top of this crate.
mod expr; mod expr;
mod item; mod item;
@ -256,6 +260,7 @@ impl std::ops::DerefMut for State<'_> {
} }
} }
/// This trait is used for both AST and HIR pretty-printing.
pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::DerefMut { pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::DerefMut {
fn comments(&mut self) -> &mut Option<Comments<'a>>; fn comments(&mut self) -> &mut Option<Comments<'a>>;
fn ann_post(&mut self, ident: Ident); fn ann_post(&mut self, ident: Ident);

View file

@ -1,3 +1,6 @@
//! HIR pretty-printing is layered on top of AST pretty-printing. A number of
//! the definitions in this file have equivalents in `rustc_ast_pretty`.
#![recursion_limit = "256"] #![recursion_limit = "256"]
#![deny(rustc::untranslatable_diagnostic)] #![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)] #![deny(rustc::diagnostic_outside_of_impl)]