about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTinco Andringa <mail@tinco.nl>2018-07-13 23:36:50 +0200
committerTinco Andringa <mail@tinco.nl>2018-09-10 12:33:38 +0200
commit23ee94e92b2111a65de9b6269df858a565656ff8 (patch)
tree4e34beae8ed82b473df37f8b4e475d7b7ca11735
parent81a8ee8fc4822a651aaea722d7920c0f780e9041 (diff)
downloadrust-23ee94e92b2111a65de9b6269df858a565656ff8.tar.gz
rust-23ee94e92b2111a65de9b6269df858a565656ff8.zip
Correctly close indentation blocks when pretty printing non-inline module
-rw-r--r--src/libsyntax/print/pprust.rs3
-rw-r--r--src/test/pretty/issue_12590_c.rs3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 74ac57a634b..f2acdb3f469 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -1268,13 +1268,14 @@ impl<'a> State<'a> {
                 self.print_ident(item.ident)?;
 
                 if _mod.inline || self.is_expanded {
-                    println!("Going to print inline anyway");
                     self.nbsp()?;
                     self.bopen()?;
                     self.print_mod(_mod, &item.attrs)?;
                     self.bclose(item.span)?;
                 } else {
                     self.s.word(";")?;
+                    self.end()?; // end inner head-block
+                    self.end()?; // end outer head-block
                 }
 
             }
diff --git a/src/test/pretty/issue_12590_c.rs b/src/test/pretty/issue_12590_c.rs
index a6b81fdefe6..e3db870ae4f 100644
--- a/src/test/pretty/issue_12590_c.rs
+++ b/src/test/pretty/issue_12590_c.rs
@@ -8,8 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// pp-exact:issue_12590_c.pp
+// pretty-compare-only
 // pretty-mode:expanded
+// pp-exact:issue_12590_c.pp
 
 // The next line should be expanded