about summary refs log tree commit diff
path: root/compiler/rustc_ast_pretty/src/helpers.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_ast_pretty/src/helpers.rs')
-rw-r--r--compiler/rustc_ast_pretty/src/helpers.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/compiler/rustc_ast_pretty/src/helpers.rs b/compiler/rustc_ast_pretty/src/helpers.rs
index dce856df9c6..5ec71cddf7d 100644
--- a/compiler/rustc_ast_pretty/src/helpers.rs
+++ b/compiler/rustc_ast_pretty/src/helpers.rs
@@ -35,4 +35,14 @@ impl Printer {
         self.word(w);
         self.nbsp()
     }
+
+    // Synthesizes a comment that was not textually present in the original
+    // source file.
+    pub fn synth_comment(&mut self, text: impl Into<Cow<'static, str>>) {
+        self.word("/*");
+        self.space();
+        self.word(text);
+        self.space();
+        self.word("*/")
+    }
 }