Skip to content

Allow aliases and template aliases to be considered for replacement #200

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
Nov 3, 2016

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Nov 3, 2016

Fixes #89.

I'm not exactly happy with the way this is implemented (making real_canonical_name public so that we can use it in replacement lookups) but I'm not sure of a better way without refactoring most of how naming works right now.

r? @emilio

Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

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

Yeah, not ultra-pretty, but I guess it makes sense, since it's what we use to get the replacement association.

r=me, optionally with those nits.

@@ -320,23 +320,28 @@ impl<'ctx> BindgenContext<'ctx> {
let mut replacements = vec![];

for (id, item) in self.items.iter() {
// Calls to `canonical_name` are expensive, so eagerly filter out
// items that cannot be replaced.

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this newline may be removed

continue;
match *ty.kind() {
TypeKind::Comp(ref ci) if !ci.is_template_specialization() => {}
TypeKind::TemplateAlias(_, _) => {}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Maybe TypeKind::TemplateAlias(_, _) | TypeKind::Alias(_, _) => {}?

@fitzgen fitzgen force-pushed the replace-template-alias branch from 124b7ca to 8041ebf Compare November 3, 2016 21:18
@fitzgen
Copy link
Member Author

fitzgen commented Nov 3, 2016

Fixed nits!

@emilio
Copy link
Contributor

emilio commented Nov 3, 2016

@bors-servo r+

Thanks!

@bors-servo
Copy link

📌 Commit 8041ebf has been approved by emilio

@bors-servo
Copy link

⌛ Testing commit 8041ebf with merge 624c32c...

bors-servo pushed a commit that referenced this pull request Nov 3, 2016
Allow aliases and template aliases to be considered for replacement

Fixes #89.

I'm not exactly *happy* with the way this is implemented (making `real_canonical_name` public so that we can use it in replacement lookups) but I'm not sure of a better way without refactoring most of how naming works right now.

r? @emilio
@bors-servo
Copy link

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit 8041ebf into rust-lang:master Nov 3, 2016
@fitzgen fitzgen deleted the replace-template-alias branch November 3, 2016 21:46
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