diff options
| author | mitaa <mitaa.ceb@gmail.com> | 2016-03-25 02:18:57 +0100 |
|---|---|---|
| committer | mitaa <mitaa.ceb@gmail.com> | 2016-03-27 00:21:00 +0100 |
| commit | d0f74b605942849b647b0e262fbda1969bd73c2a (patch) | |
| tree | 688f61c840afbe2834eb146bd11bbe97e7ceffc7 | |
| parent | 0e3a2c01679f1b86df01c739ce8299c687e5c7b6 (diff) | |
| download | rust-d0f74b605942849b647b0e262fbda1969bd73c2a.tar.gz rust-d0f74b605942849b647b0e262fbda1969bd73c2a.zip | |
Load struct-variant data correctly from metadata
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 17 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-32395.rs | 2 |
2 files changed, 7 insertions, 12 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index bec3ae799ca..4143cdaf80c 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -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)) ) @@ -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), diff --git a/src/test/rustdoc/issue-32395.rs b/src/test/rustdoc/issue-32395.rs index fba2a6ad487..672c8757049 100644 --- a/src/test/rustdoc/issue-32395.rs +++ b/src/test/rustdoc/issue-32395.rs @@ -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; |
