@@ -1730,29 +1730,27 @@ impl Clean<Item> for ast::StructField {
1730
1730
}
1731
1731
}
1732
1732
1733
- impl Clean < Item > for ty:: FieldTy {
1733
+ impl < ' tcx > Clean < Item > for ty:: FieldDef < ' tcx > {
1734
1734
fn clean ( & self , cx : & DocContext ) -> Item {
1735
1735
use syntax:: parse:: token:: special_idents:: unnamed_field;
1736
1736
use rustc:: metadata:: csearch;
1737
1737
1738
- let attr_map = csearch:: get_struct_field_attrs ( & cx. tcx ( ) . sess . cstore , self . id ) ;
1738
+ let attr_map = csearch:: get_struct_field_attrs ( & cx. tcx ( ) . sess . cstore , self . did ) ;
1739
1739
1740
1740
let ( name, attrs) = if self . name == unnamed_field. name {
1741
1741
( None , None )
1742
1742
} else {
1743
- ( Some ( self . name ) , Some ( attr_map. get ( & self . id . node ) . unwrap ( ) ) )
1743
+ ( Some ( self . name ) , Some ( attr_map. get ( & self . did . node ) . unwrap ( ) ) )
1744
1744
} ;
1745
1745
1746
- let ty = cx. tcx ( ) . lookup_item_type ( self . id ) ;
1747
-
1748
1746
Item {
1749
1747
name : name. clean ( cx) ,
1750
1748
attrs : attrs. unwrap_or ( & Vec :: new ( ) ) . clean ( cx) ,
1751
1749
source : Span :: empty ( ) ,
1752
1750
visibility : Some ( self . vis ) ,
1753
- stability : get_stability ( cx, self . id ) ,
1754
- def_id : self . id ,
1755
- inner : StructFieldItem ( TypedStructField ( ty . ty . clean ( cx) ) ) ,
1751
+ stability : get_stability ( cx, self . did ) ,
1752
+ def_id : self . did ,
1753
+ inner : StructFieldItem ( TypedStructField ( self . unsubst_ty ( ) . clean ( cx) ) ) ,
1756
1754
}
1757
1755
}
1758
1756
}
@@ -1858,22 +1856,24 @@ impl Clean<Item> for doctree::Variant {
1858
1856
}
1859
1857
}
1860
1858
1861
- impl < ' tcx > Clean < Item > for ty:: VariantInfo < ' tcx > {
1859
+ impl < ' tcx > Clean < Item > for ty:: VariantDef < ' tcx > {
1862
1860
fn clean ( & self , cx : & DocContext ) -> Item {
1863
1861
// use syntax::parse::token::special_idents::unnamed_field;
1864
- let kind = match self . arg_names . as_ref ( ) . map ( |s| & * * s) {
1865
- None | Some ( [ ] ) if self . args . is_empty ( ) => CLikeVariant ,
1866
- None | Some ( [ ] ) => {
1867
- TupleVariant ( self . args . clean ( cx) )
1862
+ let kind = match self . kind ( ) {
1863
+ ty:: VariantKind :: Unit => CLikeVariant ,
1864
+ ty:: VariantKind :: Tuple => {
1865
+ TupleVariant (
1866
+ self . fields . iter ( ) . map ( |f| f. unsubst_ty ( ) . clean ( cx) ) . collect ( )
1867
+ )
1868
1868
}
1869
- Some ( s ) => {
1869
+ ty :: VariantKind :: Dict => {
1870
1870
StructVariant ( VariantStruct {
1871
1871
struct_type : doctree:: Plain ,
1872
1872
fields_stripped : false ,
1873
- fields : s . iter ( ) . zip ( & self . args ) . map ( |( name , ty ) | {
1873
+ fields : self . fields . iter ( ) . map ( |field | {
1874
1874
Item {
1875
1875
source : Span :: empty ( ) ,
1876
- name : Some ( name. clean ( cx) ) ,
1876
+ name : Some ( field . name . clean ( cx) ) ,
1877
1877
attrs : Vec :: new ( ) ,
1878
1878
visibility : Some ( ast:: Public ) ,
1879
1879
// FIXME: this is not accurate, we need an id for
@@ -1883,10 +1883,10 @@ impl<'tcx> Clean<Item> for ty::VariantInfo<'tcx> {
1883
1883
// Struct variants are experimental and need
1884
1884
// more infrastructure work before we can get
1885
1885
// at the needed information here.
1886
- def_id : self . id ,
1887
- stability : get_stability ( cx, self . id ) ,
1886
+ def_id : self . did ,
1887
+ stability : get_stability ( cx, self . did ) ,
1888
1888
inner : StructFieldItem (
1889
- TypedStructField ( ty . clean ( cx) )
1889
+ TypedStructField ( field . unsubst_ty ( ) . clean ( cx) )
1890
1890
)
1891
1891
}
1892
1892
} ) . collect ( )
@@ -1895,12 +1895,12 @@ impl<'tcx> Clean<Item> for ty::VariantInfo<'tcx> {
1895
1895
} ;
1896
1896
Item {
1897
1897
name : Some ( self . name . clean ( cx) ) ,
1898
- attrs : inline:: load_attrs ( cx, cx. tcx ( ) , self . id ) ,
1898
+ attrs : inline:: load_attrs ( cx, cx. tcx ( ) , self . did ) ,
1899
1899
source : Span :: empty ( ) ,
1900
1900
visibility : Some ( ast:: Public ) ,
1901
- def_id : self . id ,
1901
+ def_id : self . did ,
1902
1902
inner : VariantItem ( Variant { kind : kind } ) ,
1903
- stability : get_stability ( cx, self . id ) ,
1903
+ stability : get_stability ( cx, self . did ) ,
1904
1904
}
1905
1905
}
1906
1906
}
0 commit comments