Fix C-variadic function printing

There is no longer a need to append the string `", ..."` to a functions
args as `...` is parsed as an argument and will appear in the functions
arguments.
This commit is contained in:
Dan Robertson 2019-03-02 03:14:29 +00:00
parent c1d2d83ca3
commit 04d0a8cb83
No known key found for this signature in database
GPG key ID: 45C4A652C47E42A5
2 changed files with 15 additions and 3 deletions

View file

@ -2814,9 +2814,6 @@ impl<'a> State<'a> {
-> io::Result<()> {
self.popen()?;
self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, false))?;
if decl.c_variadic {
self.s.word(", ...")?;
}
self.pclose()?;
self.print_fn_output(decl)

View file

@ -0,0 +1,15 @@
// Check that `fn foo(x: i32, ...)` does not print as `fn foo(x: i32, ..., ...)`.
// See issue #58853.
//
// pp-exact
#![feature(c_variadic)]
extern "C" {
pub fn foo(x: i32, ...);
}
pub unsafe extern "C" fn bar(_: i32, mut ap: ...) -> usize {
ap.arg::<usize>()
}
fn main() { }