Skip to content

clang::Cursor::referenced should return Option<clang::Cursor> #232

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

Conversation

11Takanori
Copy link
Contributor

Fixes #124
Since I am new to Rust, I hope I didn't do things too badly

@@ -612,7 +612,7 @@ impl Type {
TypeKind::TemplateAlias(inner.unwrap(), args)
}
CXCursor_TemplateRef => {
let referenced = location.referenced();
let referenced = location.referenced().unwrap_or(location);
Copy link
Contributor

@wafflespeanut wafflespeanut Nov 9, 2016

Choose a reason for hiding this comment

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

This should probably expect the method to return a Cursor, so that we'll know when this doesn't return one (ditto below on the same).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, we should use either unwrap or expect, if the cursor here is invalid, it's probably a bug. If it isn't, then we can return early an Err here.

Copy link
Contributor Author

@11Takanori 11Takanori Nov 13, 2016

Choose a reason for hiding this comment

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

Thank you. I changed unwrap_or to expect.

@wafflespeanut
Copy link
Contributor

Please claim the relevant issue before working on it, so that we can reduce duplicate efforts :)

Also, the merge commits should be removed.

@11Takanori
Copy link
Contributor Author

Sorry, I remove merge commits.

@11Takanori 11Takanori force-pushed the 124-clang-cursor-referenced-option-cursor branch from 058d55c to 76b5372 Compare November 13, 2016 23:27
@emilio
Copy link
Contributor

emilio commented Nov 14, 2016

@bors-servo r+

Thanks!

@bors-servo
Copy link

📌 Commit 76b5372 has been approved by emilio

@bors-servo
Copy link

⚡ Test exempted - status

@bors-servo bors-servo merged commit 76b5372 into rust-lang:master Nov 14, 2016
bors-servo pushed a commit that referenced this pull request Nov 14, 2016
…rsor, r=emilio

clang::Cursor::referenced should return Option<clang::Cursor>

Fixes #124
Since I am new to Rust, I hope I didn't do things too badly
@11Takanori 11Takanori deleted the 124-clang-cursor-referenced-option-cursor branch November 14, 2016 11:09
luser pushed a commit to luser/rust-bindgen that referenced this pull request Mar 27, 2017
…ng#232)

We use the kind for the sign and the layout's size for the width, and we
wrap unsigned values that are too large to fit inside the determined type.
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