Skip to content

codegen: Don't implement variadic methods. #403

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

Merged
merged 1 commit into from
Jan 19, 2017

Conversation

emilio
Copy link
Contributor

@emilio emilio commented Jan 18, 2017

Fixes #402

r? @fitzgen

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something is funky here. The changes look right to me, but the test code looks wrong.

// Do not generate variadic methods, since rust does not allow
// implementing them, and we don't do a good job at it anyway.
if signature.is_variadic() {
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth a debug!(...) here.

}
extern "C" {
#[link_name = "_ZN3Bar3fooEPKcz"]
pub fn Bar_foo(this: *mut Bar, fmt: *const ::std::os::raw::c_char, ...);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the point was supposed to be not to generate this, right?

First of all, we can't support variadics. Second of all, is this codegen'd a named type named ...? Need to implement the checks that named types are actually valid named types...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, the point was to not generate the wrapper method that calls this. Generating variadic functions otherwise is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(And nope, it's not a named type, rust's AST can represent variadic functions, which is what we use here)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yeah I guess the tests are passing which means it compiles. Color me surprised.

@fitzgen
Copy link
Member

fitzgen commented Jan 19, 2017

@bors-servo r+

@bors-servo
Copy link

📌 Commit b743ab0 has been approved by fitzgen

@bors-servo
Copy link

⌛ Testing commit b743ab0 with merge 4ac39de...

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

Fixes #402

r? @fitzgen
@bors-servo
Copy link

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit b743ab0 into rust-lang:master Jan 19, 2017
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

Successfully merging this pull request may close these issues.

4 participants