Skip to content

Multiple cleanups and fix for #355 #357

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 4 commits into from
Dec 23, 2016
Merged

Conversation

emilio
Copy link
Contributor

@emilio emilio commented Dec 22, 2016

Fixes #355

Also improves the output of #354.

r? @fitzgen

@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@jsgf
Copy link
Contributor

jsgf commented Dec 22, 2016

Confirm that this fixes the problem I reported in #355 in the full source.

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.

r=me thanks!

Will let you delegate to bors so you can decide whether to change the panic message...

return self.codegen(ctx, result, _whitelisted_items, item);
},
_ => panic!("How?")
_ => panic!("How did this end up here {:?}?", signature)
Copy link
Member

Choose a reason for hiding this comment

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

Soft preference for a more descriptive message here:

Signature's kind is not TypeKind::Function?! {:?}

// Assume signedness since the default type by the C standard is an int.
let is_signed = repr
.and_then(|r| ctx.resolve_type(r).safe_canonical_type(ctx))
.map_or(true, |ty| {
Copy link
Member

Choose a reason for hiding this comment

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

So much nicer :)

/// If this type has a known size, return it (in bytes). This is to
/// alleviate libclang sometimes not giving us a layout (like in the case
/// when an enum is defined inside a class with template parameters).
pub fn known_size(&self) -> Option<usize> {
Copy link
Member

Choose a reason for hiding this comment

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

Great :)

@emilio
Copy link
Contributor Author

emilio commented Dec 23, 2016

Updated the error message.

@bors-servo r=fitzgen

@bors-servo
Copy link

📌 Commit 1ad2821 has been approved by fitzgen

@bors-servo
Copy link

⌛ Testing commit 1ad2821 with merge cbc0304...

bors-servo pushed a commit that referenced this pull request Dec 23, 2016
Multiple cleanups and fix for #355

Fixes #355

Also improves the output of #354.

r? @fitzgen
@bors-servo
Copy link

☀️ Test successful - status-travis

@bors-servo bors-servo merged commit 1ad2821 into rust-lang:master Dec 23, 2016
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.

5 participants