about summary refs log tree commit diff
path: root/compiler/rustc_hir_pretty
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2025-03-27 18:29:58 +0100
committerMara Bos <m-ou.se@m-ou.se>2025-04-04 09:44:19 +0200
commit3123df8ef0cc32318d96b90620396d8b22d2ffb3 (patch)
tree28ee6de03c1eccf0558313bd560589323cd6e9f8 /compiler/rustc_hir_pretty
parent9e14530c7c27123484658c88c2148a552b01e73b (diff)
downloadrust-3123df8ef0cc32318d96b90620396d8b22d2ffb3.tar.gz
rust-3123df8ef0cc32318d96b90620396d8b22d2ffb3.zip
Implement `super let`.
Diffstat (limited to 'compiler/rustc_hir_pretty')
-rw-r--r--compiler/rustc_hir_pretty/src/lib.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs
index 8c0c17f7a7d..5a3849e7afd 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -960,12 +960,16 @@ impl<'a> State<'a> {
 
     fn print_local(
         &mut self,
+        super_: bool,
         init: Option<&hir::Expr<'_>>,
         els: Option<&hir::Block<'_>>,
         decl: impl Fn(&mut Self),
     ) {
         self.space_if_not_bol();
         self.ibox(INDENT_UNIT);
+        if super_ {
+            self.word_nbsp("super");
+        }
         self.word_nbsp("let");
 
         self.ibox(INDENT_UNIT);
@@ -995,7 +999,9 @@ impl<'a> State<'a> {
         self.maybe_print_comment(st.span.lo());
         match st.kind {
             hir::StmtKind::Let(loc) => {
-                self.print_local(loc.init, loc.els, |this| this.print_local_decl(loc));
+                self.print_local(loc.super_.is_some(), loc.init, loc.els, |this| {
+                    this.print_local_decl(loc)
+                });
             }
             hir::StmtKind::Item(item) => self.ann.nested(self, Nested::Item(item)),
             hir::StmtKind::Expr(expr) => {
@@ -1488,7 +1494,7 @@ impl<'a> State<'a> {
 
                 // Print `let _t = $init;`:
                 let temp = Ident::from_str("_t");
-                self.print_local(Some(init), None, |this| this.print_ident(temp));
+                self.print_local(false, Some(init), None, |this| this.print_ident(temp));
                 self.word(";");
 
                 // Print `_t`: