@@ -41,6 +41,13 @@ impl<'tcx> Context for Tables<'tcx> {
41
41
fn entry_fn ( & mut self ) -> Option < stable_mir:: CrateItem > {
42
42
Some ( self . crate_item ( self . tcx . entry_fn ( ( ) ) ?. 0 ) )
43
43
}
44
+
45
+ fn trait_decl ( & mut self , trait_def : & stable_mir:: ty:: TraitDef ) -> stable_mir:: ty:: TraitDecl {
46
+ let def_id = self . trait_def_id ( trait_def) ;
47
+ let trait_def = self . tcx . trait_def ( def_id) ;
48
+ trait_def. stable ( self )
49
+ }
50
+
44
51
fn mir_body ( & mut self , item : & stable_mir:: CrateItem ) -> stable_mir:: mir:: Body {
45
52
let def_id = self . item_def_id ( item) ;
46
53
let mir = self . tcx . optimized_mir ( def_id) ;
@@ -515,7 +522,7 @@ impl<'tcx> Stable<'tcx> for mir::RetagKind {
515
522
}
516
523
}
517
524
518
- impl < ' tcx > Stable < ' tcx > for rustc_middle :: ty:: UserTypeAnnotationIndex {
525
+ impl < ' tcx > Stable < ' tcx > for ty:: UserTypeAnnotationIndex {
519
526
type T = usize ;
520
527
fn stable ( & self , _: & mut Tables < ' tcx > ) -> Self :: T {
521
528
self . as_usize ( )
@@ -1045,15 +1052,15 @@ impl<'tcx> Stable<'tcx> for Ty<'tcx> {
1045
1052
}
1046
1053
}
1047
1054
1048
- impl < ' tcx > Stable < ' tcx > for rustc_middle :: ty:: ParamTy {
1055
+ impl < ' tcx > Stable < ' tcx > for ty:: ParamTy {
1049
1056
type T = stable_mir:: ty:: ParamTy ;
1050
1057
fn stable ( & self , _: & mut Tables < ' tcx > ) -> Self :: T {
1051
1058
use stable_mir:: ty:: ParamTy ;
1052
1059
ParamTy { index : self . index , name : self . name . to_string ( ) }
1053
1060
}
1054
1061
}
1055
1062
1056
- impl < ' tcx > Stable < ' tcx > for rustc_middle :: ty:: BoundTy {
1063
+ impl < ' tcx > Stable < ' tcx > for ty:: BoundTy {
1057
1064
type T = stable_mir:: ty:: BoundTy ;
1058
1065
fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
1059
1066
use stable_mir:: ty:: BoundTy ;
@@ -1091,3 +1098,42 @@ impl<'tcx> Stable<'tcx> for mir::interpret::Allocation {
1091
1098
}
1092
1099
}
1093
1100
}
1101
+
1102
+ impl < ' tcx > Stable < ' tcx > for ty:: trait_def:: TraitSpecializationKind {
1103
+ type T = stable_mir:: ty:: TraitSpecializationKind ;
1104
+ fn stable ( & self , _: & mut Tables < ' tcx > ) -> Self :: T {
1105
+ use stable_mir:: ty:: TraitSpecializationKind ;
1106
+
1107
+ match self {
1108
+ ty:: trait_def:: TraitSpecializationKind :: None => TraitSpecializationKind :: None ,
1109
+ ty:: trait_def:: TraitSpecializationKind :: Marker => TraitSpecializationKind :: Marker ,
1110
+ ty:: trait_def:: TraitSpecializationKind :: AlwaysApplicable => {
1111
+ TraitSpecializationKind :: AlwaysApplicable
1112
+ }
1113
+ }
1114
+ }
1115
+ }
1116
+
1117
+ impl < ' tcx > Stable < ' tcx > for ty:: TraitDef {
1118
+ type T = stable_mir:: ty:: TraitDecl ;
1119
+ fn stable ( & self , tables : & mut Tables < ' tcx > ) -> Self :: T {
1120
+ use stable_mir:: ty:: TraitDecl ;
1121
+
1122
+ TraitDecl {
1123
+ def_id : rustc_internal:: trait_def ( self . def_id ) ,
1124
+ unsafety : self . unsafety . stable ( tables) ,
1125
+ paren_sugar : self . paren_sugar ,
1126
+ has_auto_impl : self . has_auto_impl ,
1127
+ is_marker : self . is_marker ,
1128
+ is_coinductive : self . is_coinductive ,
1129
+ skip_array_during_method_dispatch : self . skip_array_during_method_dispatch ,
1130
+ specialization_kind : self . specialization_kind . stable ( tables) ,
1131
+ must_implement_one_of : self
1132
+ . must_implement_one_of
1133
+ . as_ref ( )
1134
+ . map ( |idents| idents. iter ( ) . map ( |ident| opaque ( ident) ) . collect ( ) ) ,
1135
+ implement_via_object : self . implement_via_object ,
1136
+ deny_explicit_impl : self . deny_explicit_impl ,
1137
+ }
1138
+ }
1139
+ }
0 commit comments