about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-02-05 18:25:33 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-02-05 18:25:33 +0100
commit504ea670ae35098da3b418e0a1e6cd963d699d2c (patch)
treed2ba07cabe2140a5df15f57c1d917f9829413fe6
parent820bfffc25fee9866aa8176529091e04b8824f09 (diff)
downloadrust-504ea670ae35098da3b418e0a1e6cd963d699d2c.tar.gz
rust-504ea670ae35098da3b418e0a1e6cd963d699d2c.zip
Add `rustc_hir_pretty::expr_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 3b163d0bc20..8efef0c612b 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -321,6 +321,10 @@ pub fn pat_to_string(ann: &dyn PpAnn, pat: &hir::Pat<'_>) -> String {
     to_string(ann, |s| s.print_pat(pat))
 }
 
+pub fn expr_to_string(ann: &dyn PpAnn, pat: &hir::Expr<'_>) -> String {
+    to_string(ann, |s| s.print_expr(pat))
+}
+
 impl<'a> State<'a> {
     fn bclose_maybe_open(&mut self, span: rustc_span::Span, close_box: bool) {
         self.maybe_print_comment(span.hi());