Skip to content

Commit d116ac4

Browse files
Rollup merge of rust-lang#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`
2 parents a9d4b01 + 504ea67 commit d116ac4

File tree

1 file changed

+4
-0
lines changed
  • compiler/rustc_hir_pretty/src

1 file changed

+4
-0
lines changed

Diff for: compiler/rustc_hir_pretty/src/lib.rs

+4
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ pub fn pat_to_string(ann: &dyn PpAnn, pat: &hir::Pat<'_>) -> String {
321321
to_string(ann, |s| s.print_pat(pat))
322322
}
323323

324+
pub fn expr_to_string(ann: &dyn PpAnn, pat: &hir::Expr<'_>) -> String {
325+
to_string(ann, |s| s.print_expr(pat))
326+
}
327+
324328
impl<'a> State<'a> {
325329
fn bclose_maybe_open(&mut self, span: rustc_span::Span, close_box: bool) {
326330
self.maybe_print_comment(span.hi());

0 commit comments

Comments
 (0)