about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-02-06 14:45:28 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-02-06 14:45:28 +0100
commitf0966d20ad4f1ccc43b503c683167e8631ea9238 (patch)
tree7a9a1fc730adc2c82b1486d091b4757df5d38784
parent504ea670ae35098da3b418e0a1e6cd963d699d2c (diff)
downloadrust-f0966d20ad4f1ccc43b503c683167e8631ea9238.tar.gz
rust-f0966d20ad4f1ccc43b503c683167e8631ea9238.zip
Add `rustc_hir_pretty::item_to_string` function
-rw-r--r--compiler/rustc_hir_pretty/src/lib.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs
index 8efef0c612b..fb1df518a88 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -325,6 +325,10 @@ pub fn expr_to_string(ann: &dyn PpAnn, pat: &hir::Expr<'_>) -> String {
     to_string(ann, |s| s.print_expr(pat))
 }
 
+pub fn item_to_string(ann: &dyn PpAnn, pat: &hir::Item<'_>) -> String {
+    to_string(ann, |s| s.print_item(pat))
+}
+
 impl<'a> State<'a> {
     fn bclose_maybe_open(&mut self, span: rustc_span::Span, close_box: bool) {
         self.maybe_print_comment(span.hi());