@@ -321,6 +321,47 @@ where
321
321
}
322
322
}
323
323
324
+ fn mark_foreign_fixed < ' tcx > (
325
+ gacx : & mut GlobalAnalysisCtxt < ' tcx > ,
326
+ gasn : & mut GlobalAssignment ,
327
+ tcx : TyCtxt < ' tcx > ,
328
+ ) {
329
+ // FIX the inputs and outputs of function declarations in extern blocks
330
+ for did in gacx. foreign_mentioned_tys . clone ( ) {
331
+ if let DefKind :: Fn = tcx. def_kind ( did) {
332
+ let sig = tcx. erase_late_bound_regions ( tcx. fn_sig ( did) ) ;
333
+ let inputs = sig
334
+ . inputs ( )
335
+ . iter ( )
336
+ . map ( |& ty| gacx. assign_pointer_ids_with_info ( ty, PointerInfo :: ANNOTATED ) )
337
+ . collect :: < Vec < _ > > ( ) ;
338
+ let inputs = gacx. lcx . mk_slice ( & inputs) ;
339
+ for input in inputs {
340
+ make_ty_fixed ( gasn, input) ;
341
+ }
342
+
343
+ let output = gacx. assign_pointer_ids_with_info ( sig. output ( ) , PointerInfo :: ANNOTATED ) ;
344
+ make_ty_fixed ( gasn, output)
345
+ }
346
+ }
347
+
348
+ // FIX the fields of structs mentioned in extern blocks
349
+ for adt_did in & gacx. adt_metadata . struct_dids {
350
+ if gacx. foreign_mentioned_tys . contains ( adt_did) {
351
+ let adt_def = tcx. adt_def ( adt_did) ;
352
+ let fields = adt_def. all_fields ( ) ;
353
+ for field in fields {
354
+ let field_lty = gacx. field_ltys [ & field. did ] ;
355
+ eprintln ! (
356
+ "adding FIXED permission for {adt_did:?} field {:?}" ,
357
+ field. did
358
+ ) ;
359
+ make_ty_fixed ( gasn, field_lty) ;
360
+ }
361
+ }
362
+ }
363
+ }
364
+
324
365
fn run ( tcx : TyCtxt ) {
325
366
let mut gacx = GlobalAnalysisCtxt :: new ( tcx) ;
326
367
let mut func_info = HashMap :: new ( ) ;
@@ -529,21 +570,7 @@ fn run(tcx: TyCtxt) {
529
570
}
530
571
}
531
572
532
- // FIX the fields of structs mentioned in extern blocks
533
- for adt_did in & gacx. adt_metadata . struct_dids {
534
- if gacx. foreign_mentioned_tys . contains ( adt_did) {
535
- let adt_def = tcx. adt_def ( adt_did) ;
536
- let fields = adt_def. all_fields ( ) ;
537
- for field in fields {
538
- let field_lty = gacx. field_ltys [ & field. did ] ;
539
- eprintln ! (
540
- "adding FIXED permission for {adt_did:?} field {:?}" ,
541
- field. did
542
- ) ;
543
- make_ty_fixed ( & mut gasn, field_lty) ;
544
- }
545
- }
546
- }
573
+ mark_foreign_fixed ( & mut gacx, & mut gasn, tcx) ;
547
574
548
575
for info in func_info. values_mut ( ) {
549
576
let num_pointers = info. acx_data . num_pointers ( ) ;
0 commit comments