@@ -152,6 +152,9 @@ pub(crate) trait SmirInterface {
152152 /// Returns whether this definition is a C string.
153153 fn adt_is_cstr ( & self , def : AdtDef ) -> bool ;
154154
155+ /// Returns the representation options for this ADT.
156+ fn adt_repr ( & self , def : AdtDef ) -> ReprOptions ;
157+
155158 /// Retrieve the function signature for the given generic arguments.
156159 fn fn_sig ( & self , def : FnDef , args : & GenericArgs ) -> PolyFnSig ;
157160
@@ -167,6 +170,17 @@ pub(crate) trait SmirInterface {
167170 /// The number of variants in this ADT.
168171 fn adt_variants_len ( & self , def : AdtDef ) -> usize ;
169172
173+ /// Discriminant for a given variant index of AdtDef.
174+ fn adt_discr_for_variant ( & self , adt : AdtDef , variant : VariantIdx ) -> Discr ;
175+
176+ /// Discriminant for a given variand index and args of a coroutine.
177+ fn coroutine_discr_for_variant (
178+ & self ,
179+ coroutine : CoroutineDef ,
180+ args : & GenericArgs ,
181+ variant : VariantIdx ,
182+ ) -> Discr ;
183+
170184 /// The name of a variant.
171185 fn variant_name ( & self , def : VariantDef ) -> Symbol ;
172186 fn variant_fields ( & self , def : VariantDef ) -> Vec < FieldDef > ;
@@ -588,8 +602,10 @@ impl<'tcx> SmirInterface for SmirContainer<'tcx, BridgeTys> {
588602 }
589603
590604 /// Returns the representation options for this ADT
591- pub ( crate ) fn adt_repr ( & self , def : AdtDef ) -> ReprOptions {
592- self . cx . adt_repr ( def)
605+ fn adt_repr ( & self , def : AdtDef ) -> ReprOptions {
606+ let mut tables = self . tables . borrow_mut ( ) ;
607+ let cx = & * self . cx . borrow ( ) ;
608+ cx. adt_repr ( def. internal ( & mut * tables, cx. tcx ) ) . stable ( & mut * tables, cx)
593609 }
594610
595611 /// Retrieve the function signature for the given generic arguments.
@@ -632,19 +648,31 @@ impl<'tcx> SmirInterface for SmirContainer<'tcx, BridgeTys> {
632648 cx. adt_variants_len ( def. internal ( & mut * tables, cx. tcx ) )
633649 }
634650
635- /// Discriminant for a given variant index of AdtDef
636- pub ( crate ) fn adt_discr_for_variant ( & self , adt : AdtDef , variant : VariantIdx ) -> Discr {
637- self . cx . adt_discr_for_variant ( adt, variant)
651+ /// Discriminant for a given variant index of AdtDef.
652+ fn adt_discr_for_variant ( & self , adt : AdtDef , variant : VariantIdx ) -> Discr {
653+ let mut tables = self . tables . borrow_mut ( ) ;
654+ let cx = & * self . cx . borrow ( ) ;
655+ cx. adt_discr_for_variant (
656+ adt. internal ( & mut * tables, cx. tcx ) ,
657+ variant. internal ( & mut * tables, cx. tcx ) ,
658+ )
659+ . stable ( & mut * tables, cx)
638660 }
639661
640- /// Discriminant for a given variand index and args of a coroutine
641- pub ( crate ) fn coroutine_discr_for_variant (
662+ /// Discriminant for a given variand index and args of a coroutine.
663+ fn coroutine_discr_for_variant (
642664 & self ,
643665 coroutine : CoroutineDef ,
644666 args : & GenericArgs ,
645667 variant : VariantIdx ,
646668 ) -> Discr {
647- self . cx . coroutine_discr_for_variant ( coroutine, args, variant)
669+ let mut tables = self . tables . borrow_mut ( ) ;
670+ let cx = & * self . cx . borrow ( ) ;
671+ let tcx = cx. tcx ;
672+ let def = coroutine. def_id ( ) . internal ( & mut * tables, tcx) ;
673+ let args_ref = args. internal ( & mut * tables, tcx) ;
674+ cx. coroutine_discr_for_variant ( def, args_ref, variant. internal ( & mut * tables, tcx) )
675+ . stable ( & mut * tables, cx)
648676 }
649677
650678 /// The name of a variant.
0 commit comments