Skip to content

Commit 15fed99

Browse files
committed
---
yaml --- r: 131757 b: refs/heads/dist-snap c: 0487e63 h: refs/heads/master i: 131755: 0c3cfe7 v: v3
1 parent 65426b9 commit 15fed99

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 457a3c991d79b971be07fce75f9d0c12848fb37c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 4d16de01d0beb84dc4a351022ea5cb587b4ab557
9+
refs/heads/dist-snap: 0487e6387b8cd7a0fc4077f7534d0ea410662b8b
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/metadata/encoder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,10 @@ fn encode_info_for_struct(ecx: &EncodeContext,
693693
encode_name(ebml_w, nm);
694694
encode_type(ecx, ebml_w, node_id_to_type(tcx, id));
695695
encode_def_id(ebml_w, local_def(id));
696+
697+
let stab = stability::lookup(ecx.tcx, field.id);
698+
encode_stability(ebml_w, stab);
699+
696700
ebml_w.end_tag();
697701
}
698702
index

branches/dist-snap/src/librustc/middle/stability.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
use util::nodemap::{NodeMap, DefIdMap};
1515
use syntax::codemap::Span;
1616
use syntax::{attr, visit};
17+
use syntax::ast;
1718
use syntax::ast::{Attribute, Block, Crate, DefId, FnDecl, NodeId, Variant};
1819
use syntax::ast::{Item, Required, Provided, TraitMethod, TypeMethod, Method};
19-
use syntax::ast::{Generics, StructDef, Ident};
20+
use syntax::ast::{Generics, StructDef, StructField, Ident};
2021
use syntax::ast_util::is_local;
2122
use syntax::attr::Stability;
2223
use syntax::visit::{FnKind, FkMethod, Visitor};
@@ -91,6 +92,11 @@ impl Visitor<Option<Stability>> for Annotator {
9192
s.ctor_id.map(|id| self.annotate(id, &[], parent.clone()));
9293
visit::walk_struct_def(self, s, parent)
9394
}
95+
96+
fn visit_struct_field(&mut self, s: &StructField, parent: Option<Stability>) {
97+
let stab = self.annotate(s.node.id, s.node.attrs.as_slice(), parent);
98+
visit::walk_struct_field(self, s, stab)
99+
}
94100
}
95101

96102
impl Index {
@@ -102,8 +108,8 @@ impl Index {
102108
extern_cache: DefIdMap::new()
103109
}
104110
};
105-
visit::walk_crate(&mut annotator, krate,
106-
attr::find_stability(krate.attrs.as_slice()));
111+
let stab = annotator.annotate(ast::CRATE_NODE_ID, krate.attrs.as_slice(), None);
112+
visit::walk_crate(&mut annotator, krate, stab);
107113
annotator.index
108114
}
109115
}

branches/dist-snap/src/librustdoc/clean/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1461,12 +1461,15 @@ impl Clean<Item> for ty::VariantInfo {
14611461
name: Some(name.clean()),
14621462
attrs: Vec::new(),
14631463
visibility: Some(ast::Public),
1464-
stability: get_stability(self.id),
14651464
// FIXME: this is not accurate, we need an id for
14661465
// the specific field but we're using the id
1467-
// for the whole variant. Nothing currently
1468-
// uses this so we should be good for now.
1466+
// for the whole variant. Thus we read the
1467+
// stability from the whole variant as well.
1468+
// Struct variants are experimental and need
1469+
// more infrastructure work before we can get
1470+
// at the needed information here.
14691471
def_id: self.id,
1472+
stability: get_stability(self.id),
14701473
inner: StructFieldItem(
14711474
TypedStructField(ty.clean())
14721475
)
@@ -1482,7 +1485,7 @@ impl Clean<Item> for ty::VariantInfo {
14821485
visibility: Some(ast::Public),
14831486
def_id: self.id,
14841487
inner: VariantItem(Variant { kind: kind }),
1485-
stability: None,
1488+
stability: get_stability(self.id),
14861489
}
14871490
}
14881491
}
@@ -1890,7 +1893,7 @@ impl Clean<Item> for ast::ForeignItem {
18901893
source: self.span.clean(),
18911894
def_id: ast_util::local_def(self.id),
18921895
visibility: self.vis.clean(),
1893-
stability: None,
1896+
stability: get_stability(ast_util::local_def(self.id)),
18941897
inner: inner,
18951898
}
18961899
}

0 commit comments

Comments
 (0)