Skip to content

Commit 8876ce4

Browse files
committed
rustc: encode is_sugared_doc on ast::Attribute
1 parent fc08779 commit 8876ce4

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/librustc/metadata/common.rs

+2
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,5 @@ pub static tag_unboxed_closure_type: uint = 0x97;
231231
pub static tag_struct_fields: uint = 0x98;
232232
pub static tag_struct_field: uint = 0x99;
233233
pub static tag_struct_field_id: uint = 0x9a;
234+
235+
pub static tag_attribute_is_sugared_doc: uint = 0x9b;

src/librustc/metadata/decoder.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,9 @@ fn get_attributes(md: ebml::Doc) -> Vec<ast::Attribute> {
10561056
match reader::maybe_get_doc(md, tag_attributes) {
10571057
Some(attrs_d) => {
10581058
reader::tagged_docs(attrs_d, tag_attribute, |attr_doc| {
1059+
let is_sugared_doc = reader::doc_as_u8(
1060+
reader::get_doc(attr_doc, tag_attribute_is_sugared_doc)
1061+
) == 1;
10591062
let meta_items = get_meta_items(attr_doc);
10601063
// Currently it's only possible to have a single meta item on
10611064
// an attribute
@@ -1067,7 +1070,7 @@ fn get_attributes(md: ebml::Doc) -> Vec<ast::Attribute> {
10671070
id: attr::mk_attr_id(),
10681071
style: ast::AttrOuter,
10691072
value: meta_item,
1070-
is_sugared_doc: false,
1073+
is_sugared_doc: is_sugared_doc,
10711074
},
10721075
span: codemap::DUMMY_SP
10731076
});

src/librustc/metadata/encoder.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1490,6 +1490,7 @@ fn encode_attributes(ebml_w: &mut Encoder, attrs: &[Attribute]) {
14901490
ebml_w.start_tag(tag_attributes);
14911491
for attr in attrs.iter() {
14921492
ebml_w.start_tag(tag_attribute);
1493+
ebml_w.wr_tagged_u8(tag_attribute_is_sugared_doc, attr.node.is_sugared_doc as u8);
14931494
encode_meta_item(ebml_w, attr.node.value);
14941495
ebml_w.end_tag();
14951496
}

0 commit comments

Comments
 (0)