-
Notifications
You must be signed in to change notification settings - Fork 707
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
Fall back to opaque types rather than panicking on parse failure #612
Conversation
Potentially solves #584 but I haven't tried to reduce those failures yet. |
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.
Not ultra-happy about it, but looks ok. r=me with the following comments addressed.
src/ir/context.rs
Outdated
@@ -424,7 +424,9 @@ impl<'ctx> BindgenContext<'ctx> { | |||
for (id, ty, loc, parent_id) in typerefs { | |||
let _resolved = { | |||
let resolved = Item::from_ty(&ty, loc, parent_id, self) | |||
.expect("What happened?"); | |||
.unwrap_or_else(|_| { | |||
Item::new_opaque_type(self.next_item_id(), &ty, self) |
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 believe we want to leave a warning here or something.
src/ir/ty.rs
Outdated
if let Ok(complex) = CompInfo::from_ty(potential_id, | ||
ty, | ||
Some(location), | ||
ctx) { |
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.
Perhaps using match
+ a separate variable may look a bit cleaner?
let complex = CompInfo::from_ty(..);
match complex {
Ok(complex) => TypeKind::Comp(complex),
Err(..) => {
warn!(...);
return Ok(ParseResult::New(...));
}
}
(or even without the variable)
Also, ditto re. warning.
@bors-servo r=emilio Thanks! Review comments addressed. |
📌 Commit f2ef3d1 has been approved by |
Fall back to opaque types rather than panicking on parse failure Getting closer to figuring out some of the other template related issues in clang 4.0, but not quite ready to land them yet. Figure this should probably land in the meantime. This is just a better fallback in the face of the unknown for panics that we've had reports of in the wild, but which I haven't had time to creduce. r? @emilio
☀️ Test successful - status-travis |
Getting closer to figuring out some of the other template related issues in clang 4.0, but not quite ready to land them yet. Figure this should probably land in the meantime. This is just a better fallback in the face of the unknown for panics that we've had reports of in the wild, but which I haven't had time to creduce.
r? @emilio