@@ -503,20 +503,20 @@ impl Emitter {
503
503
SourceType :: Float32 => BytecodeType :: Float32 ,
504
504
SourceType :: Float64 => BytecodeType :: Float64 ,
505
505
SourceType :: Class ( class_id, type_params) => BytecodeType :: Class (
506
- ClassId ( class_id . index ( ) . try_into ( ) . expect ( "overflow" ) ) ,
506
+ self . convert_class_id ( class_id ) ,
507
507
self . convert_tya ( & type_params) ,
508
508
) ,
509
509
SourceType :: TraitObject ( trait_id, type_params, bindings) => BytecodeType :: TraitObject (
510
- TraitId ( trait_id . index ( ) . try_into ( ) . expect ( "overflow" ) ) ,
510
+ self . convert_trait_id ( trait_id ) ,
511
511
self . convert_tya ( & type_params) ,
512
512
self . convert_tya ( & bindings) ,
513
513
) ,
514
514
SourceType :: Enum ( enum_id, type_params) => BytecodeType :: Enum (
515
- EnumId ( enum_id . index ( ) . try_into ( ) . expect ( "overflow" ) ) ,
515
+ self . convert_enum_id ( enum_id ) ,
516
516
self . convert_tya ( & type_params) ,
517
517
) ,
518
518
SourceType :: Struct ( struct_id, type_params) => BytecodeType :: Struct (
519
- StructId ( struct_id . index ( ) . try_into ( ) . expect ( "overflow" ) ) ,
519
+ self . convert_struct_id ( struct_id ) ,
520
520
self . convert_tya ( & type_params) ,
521
521
) ,
522
522
SourceType :: Tuple ( subtypes) => BytecodeType :: Tuple ( self . convert_tya ( & subtypes) ) ,
@@ -529,11 +529,11 @@ impl Emitter {
529
529
SourceType :: This => BytecodeType :: This ,
530
530
SourceType :: Alias ( id, type_params) => {
531
531
assert ! ( type_params. is_empty( ) ) ;
532
- BytecodeType :: TypeAlias ( AliasId ( id . index ( ) . try_into ( ) . expect ( "overflow" ) ) )
532
+ BytecodeType :: TypeAlias ( self . convert_alias_id ( id ) )
533
533
}
534
534
SourceType :: Assoc { trait_ty, assoc_id } => BytecodeType :: Assoc {
535
535
trait_ty : self . convert_trait_ty ( & trait_ty) ,
536
- assoc_id : AliasId ( assoc_id . index ( ) . try_into ( ) . expect ( "overflow" ) ) ,
536
+ assoc_id : self . convert_alias_id ( assoc_id ) ,
537
537
} ,
538
538
SourceType :: GenericAssoc {
539
539
tp_id,
@@ -542,7 +542,7 @@ impl Emitter {
542
542
} => BytecodeType :: GenericAssoc {
543
543
type_param_id : tp_id. index ( ) . try_into ( ) . expect ( "overflow" ) ,
544
544
trait_ty : self . convert_trait_ty ( & trait_ty) ,
545
- assoc_id : AliasId ( assoc_id . index ( ) . try_into ( ) . expect ( "overflow" ) ) ,
545
+ assoc_id : self . convert_alias_id ( assoc_id ) ,
546
546
} ,
547
547
_ => panic ! ( "SourceType {:?} cannot be converted to BytecodeType" , ty) ,
548
548
}
@@ -572,7 +572,7 @@ impl Emitter {
572
572
. iter ( )
573
573
. map ( |( alias_id, ty) | {
574
574
(
575
- AliasId ( alias_id . index ( ) . try_into ( ) . expect ( "overflow" ) ) ,
575
+ self . convert_alias_id ( * alias_id ) ,
576
576
self . convert_ty ( ty. clone ( ) ) ,
577
577
)
578
578
} )
0 commit comments