diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2014-11-29 17:08:30 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2014-12-12 19:11:59 +1300 |
| commit | 397dda8aa08ee540cffd36f542ebd1140227d0bd (patch) | |
| tree | ee4cc3c5f3434375ef05a0092f7df8154708b765 /src/libsyntax/print/pprust.rs | |
| parent | da83ad8e2c8e2c5f522dc59963e00f55b1f8c03b (diff) | |
| download | rust-397dda8aa08ee540cffd36f542ebd1140227d0bd.tar.gz rust-397dda8aa08ee540cffd36f542ebd1140227d0bd.zip | |
Add support for equality constraints on associated types
Diffstat (limited to 'src/libsyntax/print/pprust.rs')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index eab03f73091..26373d00aaf 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1976,6 +1976,18 @@ impl<'a> State<'a> { Inconsistent, data.types.as_slice(), |s, ty| s.print_type(&**ty))); + comma = true; + } + + for binding in data.bindings.iter() { + if comma { + try!(self.word_space(",")) + } + try!(self.print_ident(binding.ident)); + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_type(&*binding.ty)); + comma = true; } try!(word(&mut self.s, ">")) @@ -2437,8 +2449,20 @@ impl<'a> State<'a> { try!(self.word_space(",")); } - try!(self.print_ident(predicate.ident)); - try!(self.print_bounds(":", predicate.bounds.as_slice())); + match predicate { + &ast::WherePredicate::BoundPredicate(ast::WhereBoundPredicate{ident, + ref bounds, + ..}) => { + try!(self.print_ident(ident)); + try!(self.print_bounds(":", bounds.as_slice())); + } + &ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => { + try!(self.print_path(path, false)); + try!(space(&mut self.s)); + try!(self.word_space("=")); + try!(self.print_type(&**ty)); + } + } } Ok(()) |
