diff options
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index b81dc53ef68..57c01e9e3ef 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1715,7 +1715,7 @@ impl<'a> State<'a> { match els { Some(_else) => { match _else.node { - // "another else-if" + // Another `else if` block. ast::ExprKind::If(ref i, ref then, ref e) => { self.cbox(INDENT_UNIT - 1)?; self.ibox(0)?; @@ -1725,7 +1725,7 @@ impl<'a> State<'a> { self.print_block(then)?; self.print_else(e.as_ref().map(|e| &**e)) } - // "another else-if-let" + // Another `else if let` block. ast::ExprKind::IfLet(ref pats, ref expr, ref then, ref e) => { self.cbox(INDENT_UNIT - 1)?; self.ibox(0)?; @@ -1738,14 +1738,14 @@ impl<'a> State<'a> { self.print_block(then)?; self.print_else(e.as_ref().map(|e| &**e)) } - // "final else" + // Final `else` block. ast::ExprKind::Block(ref b, _) => { self.cbox(INDENT_UNIT - 1)?; self.ibox(0)?; self.s.word(" else ")?; self.print_block(b) } - // BLEAH, constraints would be great here + // Constraints would be great here! _ => { panic!("print_if saw if with weird alternative"); } @@ -2450,14 +2450,21 @@ impl<'a> State<'a> { let mut comma = data.args.len() != 0; - for binding in data.bindings.iter() { + for constraint in data.constraints.iter() { if comma { self.word_space(",")? } - self.print_ident(binding.ident)?; + self.print_ident(constraint.ident)?; self.s.space()?; - self.word_space("=")?; - self.print_type(&binding.ty)?; + match constraint.kind { + ast::AssocTyConstraintKind::Equality { ref ty } => { + self.word_space("=")?; + self.print_type(ty)?; + } + ast::AssocTyConstraintKind::Bound { ref bounds } => { + self.print_type_bounds(":", &*bounds)?; + } + } comma = true; } |
