Skip to content

Commit ae43552

Browse files
committed
---
yaml --- r: 3512 b: refs/heads/master c: 50b1953 h: refs/heads/master v: v3
1 parent 8e39362 commit ae43552

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 1e63d5303f19b103393195a64d1069728015358f
2+
refs/heads/master: 50b1953f9b13342fa8034f91164ae8bb34d43207

trunk/src/comp/pretty/pprust.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ fn print_crate(session sess, @ast::crate crate, str filename,
4141
mutable cur_lit=0u,
4242
mutable boxes=boxes,
4343
mode=mode);
44-
print_inner_attributes(s, crate.node.attrs);
45-
print_mod(s, crate.node.module);
44+
print_mod(s, crate.node.module, crate.node.attrs);
4645
eof(s.s);
4746
}
4847

@@ -186,7 +185,8 @@ fn commasep_exprs(&ps s, breaks b, vec[@ast::expr] exprs) {
186185
commasep_cmnt(s, b, exprs, print_expr, expr_span);
187186
}
188187

189-
fn print_mod(&ps s, ast::_mod _mod) {
188+
fn print_mod(&ps s, ast::_mod _mod, &vec[ast::attribute] attrs) {
189+
print_inner_attributes(s, attrs);
190190
for (@ast::view_item vitem in _mod.view_items) {
191191
print_view_item(s, vitem);
192192
}
@@ -322,8 +322,7 @@ fn print_item(&ps s, &@ast::item item) {
322322
head(s, "mod");
323323
word_nbsp(s, item.ident);
324324
bopen(s);
325-
print_inner_attributes(s, item.attrs);
326-
for (@ast::item itm in _mod.items) { print_item(s, itm); }
325+
print_mod(s, _mod, item.attrs);
327326
bclose(s, item.span);
328327
}
329328
case (ast::item_native_mod(?nmod)) {
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Test view items inside non-file-level mods
2+
3+
// This is a regression test for an issue where we were failing to
4+
// pretty-print such view items. If that happens again, this should
5+
// begin failing.
6+
7+
mod m {
8+
use std;
9+
import std::vec;
10+
fn f() -> vec[int] { vec::empty[int]() }
11+
}
12+
13+
fn main() {
14+
auto x = m::f();
15+
}

0 commit comments

Comments
 (0)