Skip to content

Commit 6dfd80e

Browse files
committed
Fix format_args!() for 32-bit.
1 parent 6cc9895 commit 6dfd80e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/rustc_ast_lowering/src/format.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,11 @@ fn expand_format_args<'hir>(
476476
// ```
477477
// Piece::num(0),
478478
// ```
479-
let zero = ctx.expr_u64(fmt.span, 0);
479+
let zero = if ctx.tcx.sess.target.pointer_width >= 64 {
480+
ctx.expr_u64(fmt.span, 0)
481+
} else {
482+
ctx.expr_u32(fmt.span, 0)
483+
};
480484
pieces.push(make_piece(ctx, sym::num, zero, macsp));
481485

482486
// ```

0 commit comments

Comments
 (0)