diff options
| author | Tinco Andringa <mail@tinco.nl> | 2018-07-12 23:35:40 +0200 |
|---|---|---|
| committer | Tinco Andringa <mail@tinco.nl> | 2018-09-10 12:33:38 +0200 |
| commit | 81a8ee8fc4822a651aaea722d7920c0f780e9041 (patch) | |
| tree | d4dcb8560fa7e5a7d5b30737e6a961871c22637d /src/libsyntax/print | |
| parent | c3afb16e1608929a816d6c0e2a0118185199aef1 (diff) | |
| download | rust-81a8ee8fc4822a651aaea722d7920c0f780e9041.tar.gz rust-81a8ee8fc4822a651aaea722d7920c0f780e9041.zip | |
pretty=expanded should expand mod declarations
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index fb4000294ea..74ac57a634b 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -61,6 +61,7 @@ pub struct State<'a> { cur_cmnt: usize, boxes: Vec<pp::Breaks>, ann: &'a (dyn PpAnn+'a), + is_expanded: bool } fn rust_printer<'a>(writer: Box<dyn Write+'a>, ann: &'a dyn PpAnn) -> State<'a> { @@ -72,6 +73,7 @@ fn rust_printer<'a>(writer: Box<dyn Write+'a>, ann: &'a dyn PpAnn) -> State<'a> cur_cmnt: 0, boxes: Vec::new(), ann, + is_expanded: false } } @@ -133,14 +135,17 @@ impl<'a> State<'a> { // If the code is post expansion, don't use the table of // literals, since it doesn't correspond with the literals // in the AST anymore. - if is_expanded { None } else { Some(lits) }) + if is_expanded { None } else { Some(lits) }, + is_expanded + ) } pub fn new(cm: &'a SourceMap, out: Box<dyn Write+'a>, ann: &'a dyn PpAnn, comments: Option<Vec<comments::Comment>>, - literals: Option<Vec<comments::Literal>>) -> State<'a> { + literals: Option<Vec<comments::Literal>>, + is_expanded: bool) -> State<'a> { State { s: pp::mk_printer(out, DEFAULT_COLUMNS), cm: Some(cm), @@ -149,6 +154,7 @@ impl<'a> State<'a> { cur_cmnt: 0, boxes: Vec::new(), ann, + is_expanded: is_expanded } } } @@ -1261,7 +1267,8 @@ impl<'a> State<'a> { self.head(&visibility_qualified(&item.vis, "mod"))?; self.print_ident(item.ident)?; - if _mod.inline { + if _mod.inline || self.is_expanded { + println!("Going to print inline anyway"); self.nbsp()?; self.bopen()?; self.print_mod(_mod, &item.attrs)?; |
