diff options
| author | Jubilee <workingjubilee@gmail.com> | 2025-02-05 19:53:53 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-05 19:53:53 -0800 |
| commit | d116ac4b0eca630e5a66c98a54527aab3c8e64e9 (patch) | |
| tree | 6668ee251db7fa22053d63700351cf8a255ce202 | |
| parent | a9d4b013a25f831643108bb3cd2e4e91da93cb78 (diff) | |
| parent | 504ea670ae35098da3b418e0a1e6cd963d699d2c (diff) | |
| download | rust-d116ac4b0eca630e5a66c98a54527aab3c8e64e9.tar.gz rust-d116ac4b0eca630e5a66c98a54527aab3c8e64e9.zip | |
Rollup merge of #136591 - GuillaumeGomez:expr-to-string, r=Urgau
Add `rustc_hir_pretty::expr_to_string` function It'll allow me to work on a new rustdoc feature. :) r? `@Urgau`
| -rw-r--r-- | compiler/rustc_hir_pretty/src/lib.rs | 4 |
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()); |
