Skip to content

Commit 6aead74

Browse files
committed
Remove unnecessary CVarArgs name skipping logic
1 parent 2c1dbed commit 6aead74

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1737,14 +1737,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17371737
}
17381738

17391739
fn lower_fn_params_to_names(&mut self, decl: &FnDecl) -> &'hir [Ident] {
1740-
// Skip the `...` (`CVarArgs`) trailing arguments from the AST,
1741-
// as they are not explicit in HIR/Ty function signatures.
1742-
// (instead, the `c_variadic` flag is set to `true`)
1743-
let mut inputs = &decl.inputs[..];
1744-
if decl.c_variadic() {
1745-
inputs = &inputs[..inputs.len() - 1];
1746-
}
1747-
self.arena.alloc_from_iter(inputs.iter().map(|param| match param.pat.kind {
1740+
self.arena.alloc_from_iter(decl.inputs.iter().map(|param| match param.pat.kind {
17481741
PatKind::Ident(_, ident, _) => self.lower_ident(ident),
17491742
_ => Ident::new(kw::Empty, self.lower_span(param.pat.span)),
17501743
}))

tests/pretty/hir-fn-variadic.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
extern crate std;
1010

1111
extern "C" {
12-
fn foo(x: i32, ...);
12+
fn foo(x: i32, va1: ...);
1313
}
1414

1515
unsafe extern "C" fn bar(_: i32, mut va2: ...) -> usize { va2.arg::<usize>() }

0 commit comments

Comments
 (0)