From ce857e3d60da1b5eff5d830dbd03f32a8890ad16 Mon Sep 17 00:00:00 2001 From: Ben Blum Date: Mon, 17 Jun 2013 15:16:30 -0400 Subject: Parse and typecheck (not kindcheck) bounds on trait paths. --- src/libsyntax/print/pprust.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/libsyntax/print') diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 8e47df51010..fa22b7ceb71 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -422,7 +422,7 @@ pub fn print_type(s: @ps, ty: @ast::Ty) { f.purity, f.onceness, &f.decl, None, Some(&generics), None); } - ast::ty_path(path, _) => print_path(s, path, false), + ast::ty_path(path, bounds, _) => print_bounded_path(s, path, bounds), ast::ty_fixed_length_vec(ref mt, v) => { word(s.s, "["); match mt.mutbl { @@ -1483,7 +1483,8 @@ pub fn print_for_decl(s: @ps, loc: @ast::local, coll: @ast::expr) { print_expr(s, coll); } -pub fn print_path(s: @ps, path: @ast::Path, colons_before_params: bool) { +fn print_path_(s: @ps, path: @ast::Path, colons_before_params: bool, + opt_bounds: Option<@OptVec>) { maybe_print_comment(s, path.span.lo); if path.global { word(s.s, "::"); } let mut first = true; @@ -1491,6 +1492,9 @@ pub fn print_path(s: @ps, path: @ast::Path, colons_before_params: bool) { if first { first = false; } else { word(s.s, "::"); } print_ident(s, *id); } + do opt_bounds.map_consume |bounds| { + print_bounds(s, bounds); + }; if path.rp.is_some() || !path.types.is_empty() { if colons_before_params { word(s.s, "::"); } @@ -1511,6 +1515,15 @@ pub fn print_path(s: @ps, path: @ast::Path, colons_before_params: bool) { } } +pub fn print_path(s: @ps, path: @ast::Path, colons_before_params: bool) { + print_path_(s, path, colons_before_params, None) +} + +pub fn print_bounded_path(s: @ps, path: @ast::Path, + bounds: @OptVec) { + print_path_(s, path, false, Some(bounds)) +} + pub fn print_irrefutable_pat(s: @ps, pat: @ast::pat) { print_pat(s, pat, false) } -- cgit 1.4.1-3-g733a5