Skip to content

Change clang::Type::num_elements to return Option #163

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
Oct 30, 2016

Conversation

catdesk
Copy link
Contributor

@catdesk catdesk commented Oct 29, 2016

Fixes #139.

@highfive
Copy link

warning Warning warning

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

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.

One nit, looks good to me with that, thanks for doing this!

@@ -673,7 +673,7 @@ impl Type {
CXType_ConstantArray => {
let inner = Item::from_ty(&ty.elem_type(), location, parent_id, ctx)
.expect("Not able to resolve array element?");
TypeKind::Array(inner, ty.num_elements())
TypeKind::Array(inner, ty.num_elements().expect("Not an array?"))
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use unwrap(), if this eventually fails, it's easy to trace it through gdb, and we expect this to be infallible.

Thanks!

@KiChjang
Copy link
Member

@catdesk Can you squash your commits? I think it's good to land after squashing.

@KiChjang
Copy link
Member

@bors-servo r+

@bors-servo
Copy link

📌 Commit 7dac420 has been approved by KiChjang

@bors-servo
Copy link

⌛ Testing commit 7dac420 with merge 63f8296...

bors-servo pushed a commit that referenced this pull request Oct 30, 2016
Change clang::Type::num_elements to return Option

Fixes #139.
@bors-servo
Copy link

☀️ Test successful - status-travis

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