1
- use crate :: ty;
1
+ use crate :: mir;
2
+ use crate :: traits;
3
+ use crate :: ty:: { self , Ty } ;
2
4
use std:: mem:: { size_of, transmute_copy, MaybeUninit } ;
3
5
4
6
#[ derive( Copy , Clone ) ]
@@ -53,32 +55,128 @@ impl<T> EraseType for &'_ ty::List<T> {
53
55
type Result = [ u8 ; size_of :: < * const ( ) > ( ) ] ;
54
56
}
55
57
56
- impl < T : Copy , E : Copy > EraseType for Result < T , E > {
57
- type Result = Self ;
58
+ impl < T > EraseType for Result < & ' _ T , traits :: query :: NoSolution > {
59
+ type Result = [ u8 ; size_of :: < Result < & ' static ( ) , traits :: query :: NoSolution > > ( ) ] ;
58
60
}
59
61
60
- impl < T : Copy > EraseType for Option < T > {
61
- type Result = Self ;
62
+ impl < T > EraseType for Result < & ' _ T , rustc_errors :: ErrorGuaranteed > {
63
+ type Result = [ u8 ; size_of :: < Result < & ' static ( ) , rustc_errors :: ErrorGuaranteed > > ( ) ] ;
62
64
}
63
65
64
- impl < T : Copy > EraseType for rustc_hir :: MaybeOwner < T > {
65
- type Result = Self ;
66
+ impl < T > EraseType for Result < & ' _ T , traits :: CodegenObligationError > {
67
+ type Result = [ u8 ; size_of :: < Result < & ' static ( ) , traits :: CodegenObligationError > > ( ) ] ;
66
68
}
67
69
68
- impl < T : Copy > EraseType for ty:: Visibility < T > {
69
- type Result = Self ;
70
+ impl < T > EraseType for Result < & ' _ T , ty:: layout :: FnAbiError < ' _ > > {
71
+ type Result = [ u8 ; size_of :: < Result < & ' static ( ) , ty :: layout :: FnAbiError < ' static > > > ( ) ] ;
70
72
}
71
73
72
- impl < T : Copy > EraseType for ty:: Binder < ' _ , T > {
73
- type Result = Self ;
74
+ impl < T > EraseType for Result < ( & ' _ T , rustc_middle:: thir:: ExprId ) , rustc_errors:: ErrorGuaranteed > {
75
+ type Result = [ u8 ; size_of :: <
76
+ Result < ( & ' static ( ) , rustc_middle:: thir:: ExprId ) , rustc_errors:: ErrorGuaranteed > ,
77
+ > ( ) ] ;
74
78
}
75
79
76
- impl < T : Copy > EraseType for ty:: EarlyBinder < T > {
77
- type Result = Self ;
80
+ impl EraseType for Result < Option < ty:: Instance < ' _ > > , rustc_errors:: ErrorGuaranteed > {
81
+ type Result =
82
+ [ u8 ; size_of :: < Result < Option < ty:: Instance < ' static > > , rustc_errors:: ErrorGuaranteed > > ( ) ] ;
78
83
}
79
84
80
- impl < T0 : Copy , T1 : Copy > EraseType for ( T0 , T1 ) {
81
- type Result = Self ;
85
+ impl EraseType for Result < Option < ty:: Const < ' _ > > , rustc_errors:: ErrorGuaranteed > {
86
+ type Result =
87
+ [ u8 ; size_of :: < Result < Option < ty:: Const < ' static > > , rustc_errors:: ErrorGuaranteed > > ( ) ] ;
88
+ }
89
+
90
+ impl EraseType for Result < ty:: GenericArg < ' _ > , traits:: query:: NoSolution > {
91
+ type Result = [ u8 ; size_of :: < Result < ty:: GenericArg < ' static > , traits:: query:: NoSolution > > ( ) ] ;
92
+ }
93
+
94
+ impl EraseType for Result < bool , ty:: layout:: LayoutError < ' _ > > {
95
+ type Result = [ u8 ; size_of :: < Result < bool , ty:: layout:: LayoutError < ' static > > > ( ) ] ;
96
+ }
97
+
98
+ impl EraseType for Result < rustc_target:: abi:: TyAndLayout < ' _ , Ty < ' _ > > , ty:: layout:: LayoutError < ' _ > > {
99
+ type Result = [ u8 ; size_of :: <
100
+ Result <
101
+ rustc_target:: abi:: TyAndLayout < ' static , Ty < ' static > > ,
102
+ ty:: layout:: LayoutError < ' static > ,
103
+ > ,
104
+ > ( ) ] ;
105
+ }
106
+
107
+ impl EraseType for Result < ty:: Const < ' _ > , mir:: interpret:: LitToConstError > {
108
+ type Result = [ u8 ; size_of :: < Result < ty:: Const < ' static > , mir:: interpret:: LitToConstError > > ( ) ] ;
109
+ }
110
+
111
+ impl EraseType for Result < mir:: ConstantKind < ' _ > , mir:: interpret:: LitToConstError > {
112
+ type Result =
113
+ [ u8 ; size_of :: < Result < mir:: ConstantKind < ' static > , mir:: interpret:: LitToConstError > > ( ) ] ;
114
+ }
115
+
116
+ impl EraseType for Result < mir:: interpret:: ConstAlloc < ' _ > , mir:: interpret:: ErrorHandled > {
117
+ type Result = [ u8 ; size_of :: <
118
+ Result < mir:: interpret:: ConstAlloc < ' static > , mir:: interpret:: ErrorHandled > ,
119
+ > ( ) ] ;
120
+ }
121
+
122
+ impl EraseType for Result < mir:: interpret:: ConstValue < ' _ > , mir:: interpret:: ErrorHandled > {
123
+ type Result = [ u8 ; size_of :: <
124
+ Result < mir:: interpret:: ConstValue < ' static > , mir:: interpret:: ErrorHandled > ,
125
+ > ( ) ] ;
126
+ }
127
+
128
+ impl EraseType for Result < Option < ty:: ValTree < ' _ > > , mir:: interpret:: ErrorHandled > {
129
+ type Result =
130
+ [ u8 ; size_of :: < Result < Option < ty:: ValTree < ' static > > , mir:: interpret:: ErrorHandled > > ( ) ] ;
131
+ }
132
+
133
+ impl EraseType for Result < & ' _ ty:: List < Ty < ' _ > > , ty:: util:: AlwaysRequiresDrop > {
134
+ type Result =
135
+ [ u8 ; size_of :: < Result < & ' static ty:: List < Ty < ' static > > , ty:: util:: AlwaysRequiresDrop > > ( ) ] ;
136
+ }
137
+
138
+ impl < T > EraseType for Option < & ' _ T > {
139
+ type Result = [ u8 ; size_of :: < Option < & ' static ( ) > > ( ) ] ;
140
+ }
141
+
142
+ impl < T > EraseType for Option < & ' _ [ T ] > {
143
+ type Result = [ u8 ; size_of :: < Option < & ' static [ ( ) ] > > ( ) ] ;
144
+ }
145
+
146
+ impl EraseType for Option < rustc_middle:: hir:: Owner < ' _ > > {
147
+ type Result = [ u8 ; size_of :: < Option < rustc_middle:: hir:: Owner < ' static > > > ( ) ] ;
148
+ }
149
+
150
+ impl EraseType for Option < mir:: DestructuredConstant < ' _ > > {
151
+ type Result = [ u8 ; size_of :: < Option < mir:: DestructuredConstant < ' static > > > ( ) ] ;
152
+ }
153
+
154
+ impl EraseType for Option < ty:: EarlyBinder < ty:: TraitRef < ' _ > > > {
155
+ type Result = [ u8 ; size_of :: < Option < ty:: EarlyBinder < ty:: TraitRef < ' static > > > > ( ) ] ;
156
+ }
157
+
158
+ impl EraseType for Option < ty:: EarlyBinder < Ty < ' _ > > > {
159
+ type Result = [ u8 ; size_of :: < Option < ty:: EarlyBinder < Ty < ' static > > > > ( ) ] ;
160
+ }
161
+
162
+ impl < T > EraseType for rustc_hir:: MaybeOwner < & ' _ T > {
163
+ type Result = [ u8 ; size_of :: < rustc_hir:: MaybeOwner < & ' static ( ) > > ( ) ] ;
164
+ }
165
+
166
+ impl < T : EraseType > EraseType for ty:: EarlyBinder < T > {
167
+ type Result = T :: Result ;
168
+ }
169
+
170
+ impl EraseType for ty:: Binder < ' _ , ty:: FnSig < ' _ > > {
171
+ type Result = [ u8 ; size_of :: < ty:: Binder < ' static , ty:: FnSig < ' static > > > ( ) ] ;
172
+ }
173
+
174
+ impl < T0 , T1 > EraseType for ( & ' _ T0 , & ' _ T1 ) {
175
+ type Result = [ u8 ; size_of :: < ( & ' static ( ) , & ' static ( ) ) > ( ) ] ;
176
+ }
177
+
178
+ impl < T0 , T1 > EraseType for ( & ' _ T0 , & ' _ [ T1 ] ) {
179
+ type Result = [ u8 ; size_of :: < ( & ' static ( ) , & ' static [ ( ) ] ) > ( ) ] ;
82
180
}
83
181
84
182
macro_rules! trivial {
@@ -94,6 +192,27 @@ macro_rules! trivial {
94
192
trivial ! {
95
193
( ) ,
96
194
bool ,
195
+ Option <( rustc_span:: def_id:: DefId , rustc_session:: config:: EntryFnType ) >,
196
+ Option <rustc_ast:: expand:: allocator:: AllocatorKind >,
197
+ Option <rustc_attr:: ConstStability >,
198
+ Option <rustc_attr:: DefaultBodyStability >,
199
+ Option <rustc_attr:: Stability >,
200
+ Option <rustc_data_structures:: svh:: Svh >,
201
+ Option <rustc_hir:: def:: DefKind >,
202
+ Option <rustc_hir:: GeneratorKind >,
203
+ Option <rustc_hir:: HirId >,
204
+ Option <rustc_middle:: middle:: stability:: DeprecationEntry >,
205
+ Option <rustc_middle:: ty:: Destructor >,
206
+ Option <rustc_middle:: ty:: ImplTraitInTraitData >,
207
+ Option <rustc_span:: def_id:: CrateNum >,
208
+ Option <rustc_span:: def_id:: DefId >,
209
+ Option <rustc_span:: def_id:: LocalDefId >,
210
+ Option <rustc_span:: Span >,
211
+ Option <rustc_target:: spec:: PanicStrategy >,
212
+ Option <usize >,
213
+ Result <( ) , rustc_errors:: ErrorGuaranteed >,
214
+ Result <( ) , rustc_middle:: traits:: query:: NoSolution >,
215
+ Result <rustc_middle:: traits:: EvaluationResult , rustc_middle:: traits:: OverflowError >,
97
216
rustc_ast:: expand:: allocator:: AllocatorKind ,
98
217
rustc_attr:: ConstStability ,
99
218
rustc_attr:: DefaultBodyStability ,
@@ -144,6 +263,7 @@ trivial! {
144
263
rustc_middle:: ty:: ReprOptions ,
145
264
rustc_middle:: ty:: UnusedGenericParams ,
146
265
rustc_middle:: ty:: util:: AlwaysRequiresDrop ,
266
+ rustc_middle:: ty:: Visibility <rustc_span:: def_id:: DefId >,
147
267
rustc_session:: config:: CrateType ,
148
268
rustc_session:: config:: EntryFnType ,
149
269
rustc_session:: config:: OptLevel ,
0 commit comments