Implement dyn Trait syntax

This commit is contained in:
Vadim Petrochenkov
2017-10-10 17:33:19 +03:00
parent 3037965b5b
commit e6115af4bd
17 changed files with 149 additions and 41 deletions

View File

@@ -1049,8 +1049,9 @@ impl<'a> State<'a> {
ast::TyKind::Path(Some(ref qself), ref path) => {
self.print_qpath(path, qself, false)?
}
ast::TyKind::TraitObject(ref bounds) => {
self.print_bounds("", &bounds[..])?;
ast::TyKind::TraitObject(ref bounds, syntax) => {
let prefix = if syntax == ast::TraitObjectSyntax::Dyn { "dyn " } else { "" };
self.print_bounds(prefix, &bounds[..])?;
}
ast::TyKind::ImplTrait(ref bounds) => {
self.print_bounds("impl ", &bounds[..])?;