@@ -1025,7 +1025,16 @@ impl DocFolder for Cache {
1025
1025
self . parent_stack . push ( did) ;
1026
1026
true
1027
1027
}
1028
- _ => false
1028
+ ref t => {
1029
+ match t. primitive_type ( ) {
1030
+ Some ( prim) => {
1031
+ let did = ast_util:: local_def ( prim. to_node_id ( ) ) ;
1032
+ self . parent_stack . push ( did) ;
1033
+ true
1034
+ }
1035
+ _ => false ,
1036
+ }
1037
+ }
1029
1038
}
1030
1039
}
1031
1040
_ => false
@@ -1037,11 +1046,6 @@ impl DocFolder for Cache {
1037
1046
Some ( item) => {
1038
1047
match item {
1039
1048
clean:: Item { attrs, inner : clean:: ImplItem ( i) , .. } => {
1040
- use clean:: { Primitive , Vector , ResolvedPath , BorrowedRef } ;
1041
- use clean:: PrimitiveType :: { Array , Slice , PrimitiveTuple } ;
1042
- use clean:: PrimitiveType :: { PrimitiveRawPointer } ;
1043
- use clean:: { FixedVector , Tuple , RawPointer } ;
1044
-
1045
1049
// extract relevant documentation for this impl
1046
1050
let dox = match attrs. into_iter ( ) . find ( |a| {
1047
1051
match * a {
@@ -1059,47 +1063,18 @@ impl DocFolder for Cache {
1059
1063
// Figure out the id of this impl. This may map to a
1060
1064
// primitive rather than always to a struct/enum.
1061
1065
let did = match i. for_ {
1062
- ResolvedPath { did, .. } |
1063
- BorrowedRef {
1064
- type_ : box ResolvedPath { did, .. } , ..
1066
+ clean :: ResolvedPath { did, .. } |
1067
+ clean :: BorrowedRef {
1068
+ type_ : box clean :: ResolvedPath { did, .. } , ..
1065
1069
} => {
1066
1070
Some ( did)
1067
1071
}
1068
1072
1069
- // References to primitives are picked up as well to
1070
- // recognize implementations for &str, this may not
1071
- // be necessary in a DST world.
1072
- Primitive ( p) |
1073
- BorrowedRef { type_ : box Primitive ( p) , ..} =>
1074
- {
1075
- Some ( ast_util:: local_def ( p. to_node_id ( ) ) )
1073
+ ref t => {
1074
+ t. primitive_type ( ) . map ( |p| {
1075
+ ast_util:: local_def ( p. to_node_id ( ) )
1076
+ } )
1076
1077
}
1077
-
1078
- FixedVector ( ..) |
1079
- BorrowedRef { type_ : box FixedVector ( ..) , .. } =>
1080
- {
1081
- Some ( ast_util:: local_def ( Array . to_node_id ( ) ) )
1082
- }
1083
-
1084
- // In a DST world, we may only need Vector, but for
1085
- // now we also pick up borrowed references
1086
- Vector ( ..) |
1087
- BorrowedRef { type_ : box Vector ( ..) , .. } =>
1088
- {
1089
- Some ( ast_util:: local_def ( Slice . to_node_id ( ) ) )
1090
- }
1091
-
1092
- Tuple ( ..) => {
1093
- let id = PrimitiveTuple . to_node_id ( ) ;
1094
- Some ( ast_util:: local_def ( id) )
1095
- }
1096
-
1097
- RawPointer ( ..) => {
1098
- let id = PrimitiveRawPointer . to_node_id ( ) ;
1099
- Some ( ast_util:: local_def ( id) )
1100
- }
1101
-
1102
- _ => None ,
1103
1078
} ;
1104
1079
1105
1080
if let Some ( did) = did {
0 commit comments