@@ -161,10 +161,11 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy owned>(
161
161
}
162
162
163
163
// Handle @, ~, and & being able to mean estrs and evecs.
164
- // If a_seq_ty is a str or a vec, make it an estr/evec
164
+ // If a_seq_ty is a str or a vec, make it an estr/evec.
165
+ // Also handle function sigils.
165
166
fn mk_maybe_vstore < AC : ast_conv , RS : region_scope copy owned> (
166
167
self : AC , rscope : RS , a_seq_ty : ast:: mt , vst : ty:: vstore ,
167
- constr : fn ( ty:: mt ) -> ty:: t ) -> ty:: t {
168
+ span : span , constr : fn ( ty:: mt ) -> ty:: t ) -> ty:: t {
168
169
169
170
let tcx = self . tcx ( ) ;
170
171
@@ -183,6 +184,25 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy owned>(
183
184
_ => ( )
184
185
}
185
186
}
187
+ ast:: ty_fn( ast:: proto_block, ast_bounds, ast_fn_decl) => {
188
+ let new_proto;
189
+ match vst {
190
+ ty:: vstore_fixed( _) => {
191
+ tcx. sess . span_err ( span, ~"fixed-length functions are not \
192
+ allowed") ;
193
+ new_proto = ast:: proto_block;
194
+ }
195
+ ty:: vstore_uniq => new_proto = ast:: proto_uniq,
196
+ ty:: vstore_box => new_proto = ast:: proto_box,
197
+ ty:: vstore_slice( _) => new_proto = ast:: proto_block
198
+ }
199
+
200
+ // Run through the normal function type conversion process.
201
+ let bounds = collect:: compute_bounds ( self . ccx ( ) , ast_bounds) ;
202
+ let fn_decl = ty_of_fn_decl ( self , rscope, new_proto, bounds,
203
+ ast_fn_decl, none) ;
204
+ return ty:: mk_fn ( tcx, fn_decl) ;
205
+ }
186
206
_ => ( )
187
207
}
188
208
@@ -227,11 +247,11 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy owned>(
227
247
ast:: ty_nil => ty:: mk_nil ( tcx) ,
228
248
ast:: ty_bot => ty:: mk_bot ( tcx) ,
229
249
ast:: ty_box( mt) => {
230
- mk_maybe_vstore ( self , rscope, mt, ty:: vstore_box,
250
+ mk_maybe_vstore ( self , rscope, mt, ty:: vstore_box, ast_ty . span ,
231
251
|tmt| ty:: mk_box ( tcx, tmt) )
232
252
}
233
253
ast:: ty_uniq( mt) => {
234
- mk_maybe_vstore ( self , rscope, mt, ty:: vstore_uniq,
254
+ mk_maybe_vstore ( self , rscope, mt, ty:: vstore_uniq, ast_ty . span ,
235
255
|tmt| ty:: mk_uniq ( tcx, tmt) )
236
256
}
237
257
ast:: ty_vec( mt) => {
@@ -246,8 +266,11 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy owned>(
246
266
}
247
267
ast:: ty_rptr ( region, mt) => {
248
268
let r = ast_region_to_region ( self , rscope, ast_ty. span , region) ;
249
- mk_maybe_vstore ( self , in_anon_rscope ( rscope, r) , mt,
269
+ mk_maybe_vstore ( self ,
270
+ in_anon_rscope ( rscope, r) ,
271
+ mt,
250
272
ty:: vstore_slice ( r) ,
273
+ ast_ty. span ,
251
274
|tmt| ty:: mk_rptr ( tcx, r, tmt) )
252
275
}
253
276
ast:: ty_tup( fields) => {
@@ -322,6 +345,7 @@ fn ast_ty_to_ty<AC: ast_conv, RS: region_scope copy owned>(
322
345
ast:: ty_fixed_length ( a_t, some ( u) ) => {
323
346
mk_maybe_vstore ( self , rscope, { ty: a_t, mutbl: ast:: m_imm} ,
324
347
ty:: vstore_fixed ( u) ,
348
+ ast_ty. span ,
325
349
|ty| {
326
350
tcx. sess . span_err (
327
351
a_t. span ,
0 commit comments