Skip to content

Fix #121: Cursor::num_template_args(...) returns Option<u32> instead of c_int #182

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

Conversation

Incognitas
Copy link

Now, functions calling Cursor::num_template_args() call expect() on the return value to make sure it is a valid value

@highfive
Copy link

highfive commented Nov 1, 2016

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.

Looks good, please take care of that nit and I'll merge it.

@@ -192,7 +197,8 @@ impl Cursor {
/// Is the referent a fully specialized template specialization without any
/// remaining free template arguments?
pub fn is_fully_specialized_template(&self) -> bool {
self.is_template() && self.num_template_args() > 0
self.is_template() && self.num_template_args()
.expect("Not a class template specialization") > 0
Copy link
Contributor

Choose a reason for hiding this comment

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

can you call unwrap directly? It's clear from the backtrace what the failure is.

Copy link
Author

Choose a reason for hiding this comment

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

Ok will do the change, thanks for the feedback

@emilio
Copy link
Contributor

emilio commented Nov 1, 2016

Thanks for doing this, that was fast! :)

@emilio
Copy link
Contributor

emilio commented Nov 1, 2016

@bors-servo r+

@bors-servo
Copy link

📌 Commit 664786a has been approved by emilio

@bors-servo
Copy link

⚡ Test exempted - status

@bors-servo bors-servo merged commit 664786a into rust-lang:master Nov 1, 2016
bors-servo pushed a commit that referenced this pull request Nov 1, 2016
Fix #121: Cursor::num_template_args(...) returns Option<u32> instead of c_int

Now, functions calling Cursor::num_template_args() call expect() on the return value to make sure it is a valid value
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