Skip to content

Commit

Permalink
Load struct-variant data correctly from metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
mitaa committed Mar 26, 2016
1 parent 0e3a2c0 commit d0f74b6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/librustdoc/clean/mod.rs
Expand Up @@ -1892,18 +1892,11 @@ impl<'tcx> Clean<Item> for ty::VariantDefData<'tcx, 'static> {
Item {
source: Span::empty(),
name: Some(field.name.clean(cx)),
attrs: Vec::new(),
attrs: cx.tcx().get_attrs(field.did).clean(cx),
visibility: Some(field.vis),
// FIXME: this is not accurate, we need an id for
// the specific field but we're using the id
// for the whole variant. Thus we read the
// stability from the whole variant as well.
// Struct variants are experimental and need
// more infrastructure work before we can get
// at the needed information here.
def_id: self.did,
stability: get_stability(cx, self.did),
deprecation: get_deprecation(cx, self.did),
def_id: field.did,
stability: get_stability(cx, field.did),
deprecation: get_deprecation(cx, field.did),
inner: StructFieldItem(
TypedStructField(field.unsubst_ty().clean(cx))
)
Expand All @@ -1916,7 +1909,7 @@ impl<'tcx> Clean<Item> for ty::VariantDefData<'tcx, 'static> {
name: Some(self.name.clean(cx)),
attrs: inline::load_attrs(cx, cx.tcx(), self.did),
source: Span::empty(),
visibility: Some(hir::Public),
visibility: Some(hir::Inherited),
def_id: self.did,
inner: VariantItem(Variant { kind: kind }),
stability: get_stability(cx, self.did),
Expand Down
2 changes: 2 additions & 0 deletions src/test/rustdoc/issue-32395.rs
Expand Up @@ -14,8 +14,10 @@

// @has variant_struct/enum.Foo.html
// @!has - 'pub qux'
// @!has - 'pub Bar'
extern crate variant_struct;

// @has issue_32395/enum.Foo.html
// @!has - 'pub qux'
// @!has - 'pub Bar'
pub use variant_struct::Foo;

0 comments on commit d0f74b6

Please sign in to comment.