Skip to content

Commit

Permalink
rustc: encode is_sugared_doc on ast::Attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
emberian committed Jul 28, 2014
1 parent fc08779 commit 8876ce4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/librustc/metadata/common.rs
Expand Up @@ -231,3 +231,5 @@ pub static tag_unboxed_closure_type: uint = 0x97;
pub static tag_struct_fields: uint = 0x98;
pub static tag_struct_field: uint = 0x99;
pub static tag_struct_field_id: uint = 0x9a;

pub static tag_attribute_is_sugared_doc: uint = 0x9b;
5 changes: 4 additions & 1 deletion src/librustc/metadata/decoder.rs
Expand Up @@ -1056,6 +1056,9 @@ fn get_attributes(md: ebml::Doc) -> Vec<ast::Attribute> {
match reader::maybe_get_doc(md, tag_attributes) {
Some(attrs_d) => {
reader::tagged_docs(attrs_d, tag_attribute, |attr_doc| {
let is_sugared_doc = reader::doc_as_u8(
reader::get_doc(attr_doc, tag_attribute_is_sugared_doc)
) == 1;
let meta_items = get_meta_items(attr_doc);
// Currently it's only possible to have a single meta item on
// an attribute
Expand All @@ -1067,7 +1070,7 @@ fn get_attributes(md: ebml::Doc) -> Vec<ast::Attribute> {
id: attr::mk_attr_id(),
style: ast::AttrOuter,
value: meta_item,
is_sugared_doc: false,
is_sugared_doc: is_sugared_doc,
},
span: codemap::DUMMY_SP
});
Expand Down
1 change: 1 addition & 0 deletions src/librustc/metadata/encoder.rs
Expand Up @@ -1490,6 +1490,7 @@ fn encode_attributes(ebml_w: &mut Encoder, attrs: &[Attribute]) {
ebml_w.start_tag(tag_attributes);
for attr in attrs.iter() {
ebml_w.start_tag(tag_attribute);
ebml_w.wr_tagged_u8(tag_attribute_is_sugared_doc, attr.node.is_sugared_doc as u8);
encode_meta_item(ebml_w, attr.node.value);
ebml_w.end_tag();
}
Expand Down

5 comments on commit 8876ce4

@bors
Copy link
Contributor

@bors bors commented on 8876ce4 Jul 28, 2014

Choose a reason for hiding this comment

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

@bors
Copy link
Contributor

@bors bors commented on 8876ce4 Jul 28, 2014

Choose a reason for hiding this comment

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

merging cmr/rust/plugin-fields = 8876ce4 into auto

@bors
Copy link
Contributor

@bors bors commented on 8876ce4 Jul 28, 2014

Choose a reason for hiding this comment

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

cmr/rust/plugin-fields = 8876ce4 merged ok, testing candidate = 8d2e716

@bors
Copy link
Contributor

@bors bors commented on 8876ce4 Jul 28, 2014

Choose a reason for hiding this comment

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

fast-forwarding master to auto = 8d2e716

Please sign in to comment.