Skip to content

Commit

Permalink
Visit + encode stability for foreign items
Browse files Browse the repository at this point in the history
Fix #19649
  • Loading branch information
tomjakubowski committed Dec 20, 2014
1 parent 44f6f52 commit fb9b451
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/librustc/metadata/encoder.rs
Expand Up @@ -1479,6 +1479,8 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
encode_inlined_item(ecx, rbml_w, IIForeignRef(nitem));
}
encode_attributes(rbml_w, &*nitem.attrs);
let stab = stability::lookup(ecx.tcx, ast_util::local_def(nitem.id));
encode_stability(rbml_w, stab);
encode_symbol(ecx, rbml_w, nitem.id);
}
ast::ForeignItemStatic(_, mutbl) => {
Expand All @@ -1490,6 +1492,8 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
encode_bounds_and_type(rbml_w, ecx,
&lookup_item_type(ecx.tcx,local_def(nitem.id)));
encode_attributes(rbml_w, &*nitem.attrs);
let stab = stability::lookup(ecx.tcx, ast_util::local_def(nitem.id));
encode_stability(rbml_w, stab);
encode_symbol(ecx, rbml_w, nitem.id);
encode_name(rbml_w, nitem.ident.name);
}
Expand Down
4 changes: 4 additions & 0 deletions src/librustc/middle/stability.rs
Expand Up @@ -111,6 +111,10 @@ impl<'v> Visitor<'v> for Annotator {
fn visit_struct_field(&mut self, s: &StructField) {
self.annotate(s.node.id, &s.node.attrs, |v| visit::walk_struct_field(v, s));
}

fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
self.annotate(i.id, &i.attrs, |_| {});
}
}

impl Index {
Expand Down

0 comments on commit fb9b451

Please sign in to comment.