Skip to content

Commit 0b7a94a

Browse files
committed
Pretty-print kinds of type params
1 parent 843767a commit 0b7a94a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/comp/syntax/print/pprust.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,10 +1195,19 @@ fn print_alias(s: &ps, m: ast::mode) {
11951195
}
11961196
}
11971197

1198+
fn print_kind(s: &ps, kind: ast::kind) {
1199+
alt kind {
1200+
ast::kind_unique. { word(s.s, "~"); }
1201+
ast::kind_shared. { word(s.s, "@"); }
1202+
_ { /* fallthrough */ }
1203+
}
1204+
}
1205+
11981206
fn print_type_params(s: &ps, params: &ast::ty_param[]) {
11991207
if ivec::len(params) > 0u {
12001208
word(s.s, "[");
12011209
fn printParam(s: &ps, param: &ast::ty_param) {
1210+
print_kind(s, param.kind);
12021211
word(s.s, param.ident);
12031212
}
12041213
commasep(s, inconsistent, params, printParam);

src/test/run-pass/swap-2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// xfail-pretty
2-
31
fn swap[@T](v: &vec[mutable T], i: int, j: int) { v.(i) <-> v.(j); }
42

53
fn main() {

0 commit comments

Comments
 (0)