Skip to content

Commit

Permalink
Pretty-print kinds of type params
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Aug 3, 2011
1 parent 843767a commit 0b7a94a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 9 additions & 0 deletions src/comp/syntax/print/pprust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1195,10 +1195,19 @@ fn print_alias(s: &ps, m: ast::mode) {
}
}

fn print_kind(s: &ps, kind: ast::kind) {
alt kind {
ast::kind_unique. { word(s.s, "~"); }
ast::kind_shared. { word(s.s, "@"); }
_ { /* fallthrough */ }
}
}

fn print_type_params(s: &ps, params: &ast::ty_param[]) {
if ivec::len(params) > 0u {
word(s.s, "[");
fn printParam(s: &ps, param: &ast::ty_param) {
print_kind(s, param.kind);
word(s.s, param.ident);
}
commasep(s, inconsistent, params, printParam);
Expand Down
2 changes: 0 additions & 2 deletions src/test/run-pass/swap-2.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// xfail-pretty

fn swap[@T](v: &vec[mutable T], i: int, j: int) { v.(i) <-> v.(j); }

fn main() {
Expand Down

0 comments on commit 0b7a94a

Please sign in to comment.