File tree Expand file tree Collapse file tree 2 files changed +4
-44
lines changed Expand file tree Collapse file tree 2 files changed +4
-44
lines changed Original file line number Diff line number Diff line change 3
3
use aster;
4
4
use ir:: layout:: Layout ;
5
5
use syntax:: ast;
6
- use syntax:: codemap:: respan;
7
6
use syntax:: ptr:: P ;
8
7
9
8
@@ -68,46 +67,7 @@ impl BlobTyBuilder {
68
67
if data_len == 1 {
69
68
inner_ty
70
69
} else {
71
- ArrayTyBuilder :: new ( ) . with_len ( data_len) . build ( inner_ty)
70
+ aster :: ty :: TyBuilder :: new ( ) . array ( data_len) . build ( inner_ty)
72
71
}
73
72
}
74
73
}
75
-
76
- pub struct ArrayTyBuilder {
77
- len : usize ,
78
- }
79
-
80
- impl ArrayTyBuilder {
81
- pub fn new ( ) -> Self {
82
- ArrayTyBuilder {
83
- len : 0 ,
84
- }
85
- }
86
-
87
- pub fn with_len ( mut self , len : usize ) -> Self {
88
- self . len = len;
89
- self
90
- }
91
-
92
- pub fn build ( self , ty : P < ast:: Ty > ) -> P < ast:: Ty > {
93
- use syntax:: codemap:: DUMMY_SP ;
94
- let size =
95
- ast:: LitKind :: Int ( self . len as u64 ,
96
- ast:: LitIntType :: Unsigned ( ast:: UintTy :: Us ) ) ;
97
- let size = ast:: ExprKind :: Lit ( P ( respan ( DUMMY_SP , size) ) ) ;
98
- let array_kind = ast:: TyKind :: FixedLengthVec ( ty,
99
- P ( ast:: Expr {
100
- id : ast:: DUMMY_NODE_ID ,
101
- node : size,
102
- span : DUMMY_SP ,
103
- attrs : ast:: ThinVec :: new ( ) ,
104
- } )
105
- ) ;
106
-
107
- P ( ast:: Ty {
108
- id : ast:: DUMMY_NODE_ID ,
109
- node : array_kind,
110
- span : DUMMY_SP ,
111
- } )
112
- }
113
- }
Original file line number Diff line number Diff line change 1
1
mod helpers;
2
2
3
- use self :: helpers:: { attributes, ArrayTyBuilder , BlobTyBuilder } ;
3
+ use self :: helpers:: { attributes, BlobTyBuilder } ;
4
4
5
5
use ir:: context:: BindgenContext ;
6
6
use ir:: item:: { Item , ItemId , ItemCanonicalName , ItemCanonicalPath } ;
@@ -1317,7 +1317,7 @@ impl ToRustTy for Type {
1317
1317
// can't do better right now. We should be able to use
1318
1318
// i128/u128 when they're available.
1319
1319
IntKind :: U128 |
1320
- IntKind :: I128 => ArrayTyBuilder :: new ( ) . with_len ( 2 ) . build ( aster:: ty:: TyBuilder :: new ( ) . u64 ( ) ) ,
1320
+ IntKind :: I128 => aster:: ty:: TyBuilder :: new ( ) . array ( 2 ) . u64 ( ) ,
1321
1321
}
1322
1322
}
1323
1323
TypeKind :: Float ( fk) => {
@@ -1336,7 +1336,7 @@ impl ToRustTy for Type {
1336
1336
}
1337
1337
TypeKind :: Array ( item, len) => {
1338
1338
let inner = item. to_rust_ty ( ctx) ;
1339
- ArrayTyBuilder :: new ( ) . with_len ( len) . build ( inner)
1339
+ aster :: ty :: TyBuilder :: new ( ) . array ( len) . build ( inner)
1340
1340
}
1341
1341
TypeKind :: Enum ( ..) => {
1342
1342
let path = item. canonical_path ( ctx) ;
You can’t perform that action at this time.
0 commit comments