mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Remove unreachable branch in format_args ast lowering.
This commit is contained in:
parent
b6c988b041
commit
0554401fcc
@ -442,25 +442,14 @@ fn expand_format_args<'hir>(
|
|||||||
let args_ident = Ident::new(sym::args, macsp);
|
let args_ident = Ident::new(sym::args, macsp);
|
||||||
let (args_pat, args_hir_id) = ctx.pat_ident(macsp, args_ident);
|
let (args_pat, args_hir_id) = ctx.pat_ident(macsp, args_ident);
|
||||||
let args = ctx.arena.alloc_from_iter(argmap.iter().map(|&(arg_index, ty)| {
|
let args = ctx.arena.alloc_from_iter(argmap.iter().map(|&(arg_index, ty)| {
|
||||||
if let Some(arg) = arguments.get(arg_index) {
|
let arg = &arguments[arg_index];
|
||||||
let sp = arg.expr.span.with_ctxt(macsp.ctxt());
|
let sp = arg.expr.span.with_ctxt(macsp.ctxt());
|
||||||
let args_ident_expr = ctx.expr_ident(macsp, args_ident, args_hir_id);
|
let args_ident_expr = ctx.expr_ident(macsp, args_ident, args_hir_id);
|
||||||
let arg = ctx.arena.alloc(ctx.expr(
|
let arg = ctx.arena.alloc(ctx.expr(
|
||||||
sp,
|
sp,
|
||||||
hir::ExprKind::Field(
|
hir::ExprKind::Field(args_ident_expr, Ident::new(sym::integer(arg_index), macsp)),
|
||||||
args_ident_expr,
|
|
||||||
Ident::new(sym::integer(arg_index), macsp),
|
|
||||||
),
|
|
||||||
));
|
));
|
||||||
make_argument(ctx, sp, arg, ty)
|
make_argument(ctx, sp, arg, ty)
|
||||||
} else {
|
|
||||||
ctx.expr(
|
|
||||||
macsp,
|
|
||||||
hir::ExprKind::Err(
|
|
||||||
ctx.tcx.sess.delay_span_bug(macsp, format!("no arg at {arg_index}")),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}));
|
}));
|
||||||
let elements: Vec<_> = arguments
|
let elements: Vec<_> = arguments
|
||||||
.iter()
|
.iter()
|
||||||
|
Loading…
Reference in New Issue
Block a user