@@ -97,6 +97,13 @@ pub enum InstanceDef<'tcx> {
97
97
///
98
98
/// The `DefId` is for `Clone::clone`, the `Ty` is the type `T` with the builtin `Clone` impl.
99
99
CloneShim ( DefId , Ty < ' tcx > ) ,
100
+
101
+ /// Compiler-generated `<T as FnPtr>::addr` implementation.
102
+ ///
103
+ /// Automatically generated for all potentially higher-ranked `fn(I) -> R` types.
104
+ ///
105
+ /// The `DefId` is for `FnPtr::Addr`, the `Ty` is the type `T`.
106
+ FnPtrAddrShim ( DefId , Ty < ' tcx > ) ,
100
107
}
101
108
102
109
impl < ' tcx > Instance < ' tcx > {
@@ -152,7 +159,8 @@ impl<'tcx> InstanceDef<'tcx> {
152
159
| InstanceDef :: Intrinsic ( def_id)
153
160
| InstanceDef :: ClosureOnceShim { call_once : def_id, track_caller : _ }
154
161
| InstanceDef :: DropGlue ( def_id, _)
155
- | InstanceDef :: CloneShim ( def_id, _) => def_id,
162
+ | InstanceDef :: CloneShim ( def_id, _)
163
+ | InstanceDef :: FnPtrAddrShim ( def_id, _) => def_id,
156
164
}
157
165
}
158
166
@@ -168,7 +176,8 @@ impl<'tcx> InstanceDef<'tcx> {
168
176
| InstanceDef :: Intrinsic ( ..)
169
177
| InstanceDef :: ClosureOnceShim { .. }
170
178
| InstanceDef :: DropGlue ( ..)
171
- | InstanceDef :: CloneShim ( ..) => None ,
179
+ | InstanceDef :: CloneShim ( ..)
180
+ | InstanceDef :: FnPtrAddrShim ( ..) => None ,
172
181
}
173
182
}
174
183
@@ -183,7 +192,8 @@ impl<'tcx> InstanceDef<'tcx> {
183
192
| InstanceDef :: Intrinsic ( def_id)
184
193
| InstanceDef :: ClosureOnceShim { call_once : def_id, track_caller : _ }
185
194
| InstanceDef :: DropGlue ( def_id, _)
186
- | InstanceDef :: CloneShim ( def_id, _) => ty:: WithOptConstParam :: unknown ( def_id) ,
195
+ | InstanceDef :: CloneShim ( def_id, _)
196
+ | InstanceDef :: FnPtrAddrShim ( def_id, _) => ty:: WithOptConstParam :: unknown ( def_id) ,
187
197
}
188
198
}
189
199
@@ -265,6 +275,7 @@ impl<'tcx> InstanceDef<'tcx> {
265
275
pub fn has_polymorphic_mir_body ( & self ) -> bool {
266
276
match * self {
267
277
InstanceDef :: CloneShim ( ..)
278
+ | InstanceDef :: FnPtrAddrShim ( ..)
268
279
| InstanceDef :: FnPtrShim ( ..)
269
280
| InstanceDef :: DropGlue ( _, Some ( _) ) => false ,
270
281
InstanceDef :: ClosureOnceShim { .. }
@@ -299,6 +310,7 @@ impl<'tcx> fmt::Display for Instance<'tcx> {
299
310
InstanceDef :: DropGlue ( _, None ) => write ! ( f, " - shim(None)" ) ,
300
311
InstanceDef :: DropGlue ( _, Some ( ty) ) => write ! ( f, " - shim(Some({}))" , ty) ,
301
312
InstanceDef :: CloneShim ( _, ty) => write ! ( f, " - shim({})" , ty) ,
313
+ InstanceDef :: FnPtrAddrShim ( _, ty) => write ! ( f, " - shim({})" , ty) ,
302
314
}
303
315
}
304
316
}
0 commit comments