summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_hir_pretty
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_hir_pretty')
-rw-r--r--compiler/rustc_hir_pretty/src/lib.rs29
1 files changed, 26 insertions, 3 deletions
diff --git a/compiler/rustc_hir_pretty/src/lib.rs b/compiler/rustc_hir_pretty/src/lib.rs
index 74f5b3590..d93e8efc1 100644
--- a/compiler/rustc_hir_pretty/src/lib.rs
+++ b/compiler/rustc_hir_pretty/src/lib.rs
@@ -1407,10 +1407,16 @@ impl<'a> State<'a> {
self.print_type(ty);
}
hir::ExprKind::Type(expr, ty) => {
- let prec = AssocOp::Colon.precedence() as i8;
- self.print_expr_maybe_paren(expr, prec);
- self.word_space(":");
+ self.word("type_ascribe!(");
+ self.ibox(0);
+ self.print_expr(expr);
+
+ self.word(",");
+ self.space_if_not_bol();
self.print_type(ty);
+
+ self.end();
+ self.word(")");
}
hir::ExprKind::DropTemps(init) => {
// Print `{`:
@@ -1551,6 +1557,23 @@ impl<'a> State<'a> {
self.word("asm!");
self.print_inline_asm(asm);
}
+ hir::ExprKind::OffsetOf(container, ref fields) => {
+ self.word("offset_of!(");
+ self.print_type(container);
+ self.word(",");
+ self.space();
+
+ if let Some((&first, rest)) = fields.split_first() {
+ self.print_ident(first);
+
+ for &field in rest {
+ self.word(".");
+ self.print_ident(field);
+ }
+ }
+
+ self.word(")");
+ }
hir::ExprKind::Yield(expr, _) => {
self.word_space("yield");
self.print_expr_maybe_paren(expr, parser::PREC_JUMP);