Skip to content

Move self into ir::BindgenContext::gen #1079

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 2 commits into from
Oct 12, 2017

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Oct 12, 2017

Small clean up. See each commit for details.

r? @pepyakin

`parse_one` was never supposed to be public and it uses a bunch of non-public
types as a parameters, so downstream crates wouldn't be able to call it anyways.
self.in_codegen = false;
ret
let ret = cb(&self);
(ret, self.into())
Copy link
Contributor

Choose a reason for hiding this comment

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

I dont think I've grasped all the idioms of Rust, but still, this seems quite unusual to me. Maybe it would be better to just use (ret, self.options)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah! This is from when I was trying to do the conversion inside codegen rather than here, and privacy wouldn't have allowed that. Good eye!

Copy link
Contributor

@pepyakin pepyakin left a comment

Choose a reason for hiding this comment

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

one question, otherwise 🤘

`bindgen` follows a pipeline architecture, and we only ever generate bindings
once. By taking ownership of `self`, we can enforce this. We can also remove
checks inside `gen` for whether we have resolved type refs or not, since we now
know that we haven't because it is guaranteed to only be called the one time.
@fitzgen fitzgen force-pushed the move-self-into-gen branch from 6db2c60 to 6f401c5 Compare October 12, 2017 20:32
@fitzgen
Copy link
Member Author

fitzgen commented Oct 12, 2017

@bors-servo r=pepyakin

@bors-servo
Copy link

📌 Commit 6f401c5 has been approved by pepyakin

bors-servo pushed a commit that referenced this pull request Oct 12, 2017
Move `self` into `ir::BindgenContext::gen`

Small clean up. See each commit for details.

r? @pepyakin
@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: pepyakin
Pushing d5a5c50 to master...

@bors-servo bors-servo merged commit 6f401c5 into rust-lang:master Oct 12, 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