Skip to content

Commit dc7f0eb

Browse files
committed
Change assert to span_err.
1 parent 40e16c2 commit dc7f0eb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/rustc_ast_lowering/src/format.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ fn expand_format_args<'hir>(
428428
bytecode.push(0);
429429

430430
// Ensure all argument indexes actually fit in 16 bits, as we truncated them to 16 bits before.
431-
assert!(argmap.len() <= u16::MAX as usize);
431+
if argmap.len() > u16::MAX as usize {
432+
ctx.dcx().span_err(macsp, "too many format arguments");
433+
}
432434

433435
let arguments = fmt.arguments.all_args();
434436

0 commit comments

Comments
 (0)