-
Notifications
You must be signed in to change notification settings - Fork 747
Derive debug and opaque types #847
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
Derive debug and opaque types #847
Conversation
I think I may need to update some libclang version specific tests once I get word back from Travis CI... |
src/ir/analysis/derive_debug.rs
Outdated
let layout_can_derive = ty.layout(self.ctx).map_or(true, |l| { | ||
l.opaque().can_trivially_derive_debug(self.ctx, ()) | ||
}); | ||
if layout_can_derive { |
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.
nit: return if
?
}; | ||
|
||
// This should not end up deriving Debug because its `mBlah` field cannot derive | ||
// Debug because the instantiation's definition cannot derive Debug. | ||
class ContainsOpaqueTemplate { |
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.
Part of the point of the test is that we derived debug for the instantiation if we could, could you add that back, maybe as another different test-case?
/* automatically generated by rust-bindgen */ | ||
|
||
|
||
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] |
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.
Oh, sure, disregard my previous comment :-)
There are lots of different ways that a type can end up being opaque, and it is best to handle all the ways in one fell swoop, rather than check each different ways (for example, if a struct has non-type template params, if a template instantiation's template definition has them, etc...) for each different type kind.
Useful for debugging when constraints go wrong.
And also not just fields, but also base members.
162a34c
to
684fc38
Compare
@bors-servo r=emilio Thanks for review :) |
📌 Commit 684fc38 has been approved by |
Derive debug and opaque types See each commit for details. Follow up to #842. r? @emilio or @Manishearth
☀️ Test successful - status-travis |
See each commit for details.
Follow up to #842.
r? @emilio or @Manishearth