Skip to content

Commit 97f605e

Browse files
committed
rollup merge of #20081: tomjakubowski/issue-19646
Encode foreign item attributes and stability levels and visit foreign items in the stability visitor. cc @gankro
2 parents 40e1f7c + fb9b451 commit 97f605e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/librustc/metadata/encoder.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,6 +1478,9 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
14781478
if abi == abi::RustIntrinsic {
14791479
encode_inlined_item(ecx, rbml_w, IIForeignRef(nitem));
14801480
}
1481+
encode_attributes(rbml_w, &*nitem.attrs);
1482+
let stab = stability::lookup(ecx.tcx, ast_util::local_def(nitem.id));
1483+
encode_stability(rbml_w, stab);
14811484
encode_symbol(ecx, rbml_w, nitem.id);
14821485
}
14831486
ast::ForeignItemStatic(_, mutbl) => {
@@ -1488,6 +1491,9 @@ fn encode_info_for_foreign_item(ecx: &EncodeContext,
14881491
}
14891492
encode_bounds_and_type(rbml_w, ecx,
14901493
&lookup_item_type(ecx.tcx,local_def(nitem.id)));
1494+
encode_attributes(rbml_w, &*nitem.attrs);
1495+
let stab = stability::lookup(ecx.tcx, ast_util::local_def(nitem.id));
1496+
encode_stability(rbml_w, stab);
14911497
encode_symbol(ecx, rbml_w, nitem.id);
14921498
encode_name(rbml_w, nitem.ident.name);
14931499
}

src/librustc/middle/stability.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ impl<'v> Visitor<'v> for Annotator {
129129
self.annotate(s.node.id, true, &s.node.attrs,
130130
|v| visit::walk_struct_field(v, s));
131131
}
132+
133+
fn visit_foreign_item(&mut self, i: &ast::ForeignItem) {
134+
self.annotate(i.id, &i.attrs, |_| {});
135+
}
132136
}
133137

134138
impl Index {

0 commit comments

Comments
 (0)