Skip to content

Commit 95b7b79

Browse files
committed
---
yaml --- r: 11726 b: refs/heads/master c: 92ed73d h: refs/heads/master v: v3
1 parent 0050d4e commit 95b7b79

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c40bfec45dee4957a56c4d6dd5bad21c91b40b5c
2+
refs/heads/master: 92ed73d0bd0a5d0871658c379a3f547d08f42b95
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustc/syntax/print/pprust.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,14 @@ fn print_native_mod(s: ps, nmod: ast::native_mod, attrs: [ast::attribute]) {
313313
for item: @ast::native_item in nmod.items { print_native_item(s, item); }
314314
}
315315

316+
fn print_region(s: ps, region: ast::region) {
317+
alt region {
318+
ast::re_inferred { /* no-op */ }
319+
ast::re_named(name) { word(s.s, name); word(s.s, "."); }
320+
ast::re_self { word(s.s, "self"); word(s.s, "."); }
321+
}
322+
}
323+
316324
fn print_type(s: ps, &&ty: @ast::ty) {
317325
maybe_print_comment(s, ty.span.lo);
318326
ibox(s, 0u);
@@ -332,7 +340,11 @@ fn print_type(s: ps, &&ty: @ast::ty) {
332340
word(s.s, "]");
333341
}
334342
ast::ty_ptr(mt) { word(s.s, "*"); print_mt(s, mt); }
335-
ast::ty_rptr(region, mt) { fail "TODO"; }
343+
ast::ty_rptr(region, mt) {
344+
word(s.s, "&");
345+
print_region(s, region);
346+
print_mt(s, mt);
347+
}
336348
ast::ty_rec(fields) {
337349
word(s.s, "{");
338350
fn print_field(s: ps, f: ast::ty_field) {
@@ -878,6 +890,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
878890
print_op_maybe_parens(s, expr, parse::parser::unop_prec);
879891
}
880892
ast::expr_addr_of(m, expr) {
893+
word(s.s, "&");
881894
print_mutability(s, m);
882895
print_expr(s, expr);
883896
}

trunk/src/test/run-pass/simple-regions.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
// xfail-pretty
2-
31
fn main() {
4-
unsafe {
5-
let x : int = 3;
6-
let y : &mut int = &mut x;
2+
unsafe{
3+
let x: int = 3;
4+
let y: &mutable int = &mutable x;
75
*y = 5;
8-
log(debug, *y);
6+
log (debug, *y);
97
}
108
}
119

0 commit comments

Comments
 (0)