@@ -493,7 +493,27 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> {
493
493
substs. substs
494
494
}
495
495
ty:: TyFnDef ( _, substs) => substs,
496
- _ => bug ! ( ) ,
496
+
497
+ // FIXME. When we encounter other sorts of constant
498
+ // expressions, such as the `22` in `[foo; 22]`, we can
499
+ // get the type `usize` here. For now, just return an
500
+ // empty vector of substs in this case, since there are no
501
+ // generics in scope in such expressions right now.
502
+ //
503
+ // Eventually I imagine we could get a wider range of
504
+ // types. What is the best way to handle this? Should we
505
+ // be checking something other than the type of the def-id
506
+ // to figure out what to do (e.g. the def-key?).
507
+ ty:: TyUint ( ..) => {
508
+ assert ! ( identity_substs. is_empty( ) ) ;
509
+ identity_substs
510
+ }
511
+
512
+ _ => span_bug ! (
513
+ tcx. def_span( self . mir_def_id) ,
514
+ "unknown defining type: {:?}" ,
515
+ defining_ty
516
+ ) ,
497
517
} ;
498
518
499
519
let global_mapping = iter:: once ( ( gcx. types . re_static , fr_static) ) ;
@@ -551,7 +571,15 @@ impl<'cx, 'gcx, 'tcx> UniversalRegionsBuilder<'cx, 'gcx, 'tcx> {
551
571
ty:: TyFnDef ( def_id, _) => {
552
572
let sig = tcx. fn_sig ( def_id) ;
553
573
let sig = indices. fold_to_region_vids ( tcx, & sig) ;
554
- return sig. inputs_and_output ( ) ;
574
+ sig. inputs_and_output ( )
575
+ }
576
+
577
+ // FIXME: as above, this happens on things like `[foo;
578
+ // 22]`. For now, no inputs, one output, but it seems like
579
+ // we need a more general way to handle this category of
580
+ // MIR.
581
+ ty:: TyUint ( ..) => {
582
+ ty:: Binder :: dummy ( tcx. mk_type_list ( iter:: once ( defining_ty) ) )
555
583
}
556
584
557
585
_ => span_bug ! (
0 commit comments