@@ -96,6 +96,13 @@ pub enum InstanceDef<'tcx> {
96
96
///
97
97
/// The `DefId` is for `Clone::clone`, the `Ty` is the type `T` with the builtin `Clone` impl.
98
98
CloneShim ( DefId , Ty < ' tcx > ) ,
99
+
100
+ /// Compiler-generated `<T as FnPtr>::addr` implementation.
101
+ ///
102
+ /// Automatically generated for all potentially higher-ranked `fn(I) -> R` types.
103
+ ///
104
+ /// The `DefId` is for `FnPtr::addr`, the `Ty` is the type `T`.
105
+ FnPtrAddrShim ( DefId , Ty < ' tcx > ) ,
99
106
}
100
107
101
108
impl < ' tcx > Instance < ' tcx > {
@@ -151,7 +158,8 @@ impl<'tcx> InstanceDef<'tcx> {
151
158
| InstanceDef :: Intrinsic ( def_id)
152
159
| InstanceDef :: ClosureOnceShim { call_once : def_id, track_caller : _ }
153
160
| InstanceDef :: DropGlue ( def_id, _)
154
- | InstanceDef :: CloneShim ( def_id, _) => def_id,
161
+ | InstanceDef :: CloneShim ( def_id, _)
162
+ | InstanceDef :: FnPtrAddrShim ( def_id, _) => def_id,
155
163
}
156
164
}
157
165
@@ -167,7 +175,8 @@ impl<'tcx> InstanceDef<'tcx> {
167
175
| InstanceDef :: Intrinsic ( ..)
168
176
| InstanceDef :: ClosureOnceShim { .. }
169
177
| InstanceDef :: DropGlue ( ..)
170
- | InstanceDef :: CloneShim ( ..) => None ,
178
+ | InstanceDef :: CloneShim ( ..)
179
+ | InstanceDef :: FnPtrAddrShim ( ..) => None ,
171
180
}
172
181
}
173
182
@@ -182,7 +191,8 @@ impl<'tcx> InstanceDef<'tcx> {
182
191
| InstanceDef :: Intrinsic ( def_id)
183
192
| InstanceDef :: ClosureOnceShim { call_once : def_id, track_caller : _ }
184
193
| InstanceDef :: DropGlue ( def_id, _)
185
- | InstanceDef :: CloneShim ( def_id, _) => ty:: WithOptConstParam :: unknown ( def_id) ,
194
+ | InstanceDef :: CloneShim ( def_id, _)
195
+ | InstanceDef :: FnPtrAddrShim ( def_id, _) => ty:: WithOptConstParam :: unknown ( def_id) ,
186
196
}
187
197
}
188
198
@@ -268,6 +278,7 @@ impl<'tcx> InstanceDef<'tcx> {
268
278
pub fn has_polymorphic_mir_body ( & self ) -> bool {
269
279
match * self {
270
280
InstanceDef :: CloneShim ( ..)
281
+ | InstanceDef :: FnPtrAddrShim ( ..)
271
282
| InstanceDef :: FnPtrShim ( ..)
272
283
| InstanceDef :: DropGlue ( _, Some ( _) ) => false ,
273
284
InstanceDef :: ClosureOnceShim { .. }
@@ -306,6 +317,7 @@ fn fmt_instance(
306
317
InstanceDef :: DropGlue ( _, None ) => write ! ( f, " - shim(None)" ) ,
307
318
InstanceDef :: DropGlue ( _, Some ( ty) ) => write ! ( f, " - shim(Some({}))" , ty) ,
308
319
InstanceDef :: CloneShim ( _, ty) => write ! ( f, " - shim({})" , ty) ,
320
+ InstanceDef :: FnPtrAddrShim ( _, ty) => write ! ( f, " - shim({})" , ty) ,
309
321
}
310
322
}
311
323
0 commit comments