self.print_lifetime(lifetime)?;
}
}
- hir::TyImplTrait(ref bounds) => {
- self.print_bounds("impl ", &bounds[..])?;
+ hir::TyImplTraitExistential(ref existty, ref _lifetimes) => {
+ self.print_bounds("impl", &existty.bounds[..])?;
+ }
+ hir::TyImplTraitUniversal(_, ref bounds) => {
+ self.print_bounds("impl", &bounds[..])?;
}
hir::TyArray(ref ty, v) => {
self.s.word("[")?;
self.head(&visibility_qualified(&item.vis, "union"))?;
self.print_struct(struct_def, generics, item.name, item.span, true)?;
}
- hir::ItemDefaultImpl(unsafety, ref trait_ref) => {
+ hir::ItemAutoImpl(unsafety, ref trait_ref) => {
self.head("")?;
self.print_visibility(&item.vis)?;
self.print_unsafety(unsafety)?;
}
self.bclose(item.span)?;
}
- hir::ItemTrait(unsafety, ref generics, ref bounds, ref trait_items) => {
+ hir::ItemTrait(is_auto, unsafety, ref generics, ref bounds, ref trait_items) => {
self.head("")?;
self.print_visibility(&item.vis)?;
+ self.print_is_auto(is_auto)?;
self.print_unsafety(unsafety)?;
self.word_nbsp("trait")?;
self.print_name(item.name)?;
Fixity::None => (prec + 1, prec + 1),
};
+ let left_prec = match (&lhs.node, op.node) {
+ // These cases need parens: `x as i32 < y` has the parser thinking that `i32 < y` is
+ // the beginning of a path type. It starts trying to parse `x as (i32 < y ...` instead
+ // of `(x as i32) < ...`. We need to convince it _not_ to do that.
+ (&hir::ExprCast { .. }, hir::BinOp_::BiLt) |
+ (&hir::ExprCast { .. }, hir::BinOp_::BiShl) => parser::PREC_FORCE_PAREN,
+ _ => left_prec,
+ };
+
self.print_expr_maybe_paren(lhs, left_prec)?;
self.s.space()?;
self.word_space(op.node.as_str())?;
hir::Unsafety::Unsafe => self.word_nbsp("unsafe"),
}
}
+
+ pub fn print_is_auto(&mut self, s: hir::IsAuto) -> io::Result<()> {
+ match s {
+ hir::IsAuto::Yes => self.word_nbsp("auto"),
+ hir::IsAuto::No => Ok(()),
+ }
+ }
}
// Dup'ed from parse::classify, but adapted for the HIR.