-
Notifications
You must be signed in to change notification settings - Fork 743
change return value of Type::pointee_type() to Option<Type> #203
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
Please claim the relevant issue before working on it, so that we can reduce duplicate efforts :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, r=me with that :)
Type { | ||
x: clang_getPointeeType(self.x), | ||
pub fn pointee_type(&self) -> Option<Type> { | ||
match self.x.kind { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you use self.kind()
? not a big deal in this case, but better to be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realise we had that method, thank you!
Never mind. I was wrong. |
CXType_MemberPointer => { | ||
unsafe { | ||
Some(Type { x: clang_getPointeeType(self.x) }) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, for some reason my other comment was lost.
Can you assert the type is valid here?
let ret = Type {
x: unsafe { clang_getPointeeType(self.x) },
};
debug_assert!(ret.kind() != CXType_Invalid);
Some(ret)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
@bors-servo r+ Thanks! |
📌 Commit 45dd2ae has been approved by |
change return value of Type::pointee_type() to Option<Type> Fixes #137
☀️ Test successful - status-travis |
Fixes #137