summaryrefslogtreecommitdiff
path: root/src/codegen/impl_debug.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-10-05 12:54:39 -0500
committerGitHub <noreply@github.com>2017-10-05 12:54:39 -0500
commit7bbfb4454e7c363c000b35a3b2e0d330c1435057 (patch)
tree5c35ffcc204cbe06afec19649f1ce0944ef57dfa /src/codegen/impl_debug.rs
parent8387c7f5888e4e9b17828cfc6803dbbbd4fb6e47 (diff)
parent91796cf94039b6df1c758011b650e25f9bfd0d66 (diff)
Auto merge of #1058 - pepyakin:bitfield-accessors, r=fitzgen
Generate bitfield accessor names eagerly @fitzgen r? I'm not sure about `deanonymize_fields`, as we now assign names to data members and also generate names for the bitfield accessors, but can't come up with a better name.
Diffstat (limited to 'src/codegen/impl_debug.rs')
-rw-r--r--src/codegen/impl_debug.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/codegen/impl_debug.rs b/src/codegen/impl_debug.rs
index 2ebcaf1a..e0204f4d 100644
--- a/src/codegen/impl_debug.rs
+++ b/src/codegen/impl_debug.rs
@@ -28,7 +28,6 @@ pub fn gen_debug_impl(
&Field::Bitfields(ref bu) => bu.impl_debug(ctx, ()),
});
-
for (i, (fstring, toks)) in processed_fields.enumerate() {
if i > 0 {
format_string.push_str(", ");
@@ -91,14 +90,15 @@ impl<'a> ImplDebug<'a> for BitfieldUnit {
) -> Option<(String, Vec<quote::Tokens>)> {
let mut format_string = String::new();
let mut tokens = vec![];
- for (i, bu) in self.bitfields().iter().enumerate() {
+ for (i, bitfield) in self.bitfields().iter().enumerate() {
if i > 0 {
format_string.push_str(", ");
}
- if let Some(name) = bu.name() {
- format_string.push_str(&format!("{} : {{:?}}", name));
- let name_ident = ctx.rust_ident_raw(name);
+ if let Some(bitfield_name) = bitfield.name() {
+ format_string.push_str(&format!("{} : {{:?}}", bitfield_name));
+ let getter_name = bitfield.getter_name();
+ let name_ident = ctx.rust_ident_raw(getter_name);
tokens.push(quote! {
self.#name_ident ()
});