Skip to content

Variadic argument member function failure. #402

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kkimdev opened this issue Jan 18, 2017 · 4 comments
Closed

Variadic argument member function failure. #402

kkimdev opened this issue Jan 18, 2017 · 4 comments

Comments

@kkimdev
Copy link

kkimdev commented Jan 18, 2017

It happens when the variadic argument function is defined as a class member function. Then like the below, rust-bindgen tries to generate ... argument for a non-foreign function, which current rustc doesn't support.

Example:

Header:

// In some class
String& AppendWithFormat(const char* formatString, ...);

Generated code:

// In some impl
    #[inline]
    pub unsafe fn AppendWithFormat(&mut self,
                                   formatString:
                                       *const ::std::os::raw::c_char, ...)
     -> *mut Urho3D_String {
        Urho3D_String_AppendWithFormat(&mut *self, formatString)
    }

Compiling the above generated code:

error: expected pattern, found `...`
    --> src/generated.rs:1203:71
     |
1203 |                                        *const ::std::os::raw::c_char, ...)

I think we should disable code generation for this case and emit a warning for now, unless there is an easy solution for this.

@kkimdev
Copy link
Author

kkimdev commented Jan 18, 2017

@luqmana

@emilio
Copy link
Contributor

emilio commented Jan 18, 2017

#403

bors-servo pushed a commit that referenced this issue Jan 19, 2017
bors-servo pushed a commit that referenced this issue Jan 19, 2017
codegen: Don't implement variadic methods.

Fixes #402

r? @fitzgen
@kkimdev
Copy link
Author

kkimdev commented Jan 19, 2017

Maybe we can keep this issue open for a proper future fix?

@emilio
Copy link
Contributor

emilio commented Jan 19, 2017

I think we should open another issue to track that work, I opened #407

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants