@@ -97,6 +97,13 @@ pub enum InstanceDef<'tcx> {
9797 ///
9898 /// The `DefId` is for `Clone::clone`, the `Ty` is the type `T` with the builtin `Clone` impl.
9999 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 > ) ,
100107}
101108
102109impl < ' tcx > Instance < ' tcx > {
@@ -152,7 +159,8 @@ impl<'tcx> InstanceDef<'tcx> {
152159 | InstanceDef :: Intrinsic ( def_id)
153160 | InstanceDef :: ClosureOnceShim { call_once : def_id, track_caller : _ }
154161 | InstanceDef :: DropGlue ( def_id, _)
155- | InstanceDef :: CloneShim ( def_id, _) => def_id,
162+ | InstanceDef :: CloneShim ( def_id, _)
163+ | InstanceDef :: FnPtrAddrShim ( def_id, _) => def_id,
156164 }
157165 }
158166
@@ -168,7 +176,8 @@ impl<'tcx> InstanceDef<'tcx> {
168176 | InstanceDef :: Intrinsic ( ..)
169177 | InstanceDef :: ClosureOnceShim { .. }
170178 | InstanceDef :: DropGlue ( ..)
171- | InstanceDef :: CloneShim ( ..) => None ,
179+ | InstanceDef :: CloneShim ( ..)
180+ | InstanceDef :: FnPtrAddrShim ( ..) => None ,
172181 }
173182 }
174183
@@ -183,7 +192,8 @@ impl<'tcx> InstanceDef<'tcx> {
183192 | InstanceDef :: Intrinsic ( def_id)
184193 | InstanceDef :: ClosureOnceShim { call_once : def_id, track_caller : _ }
185194 | 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) ,
187197 }
188198 }
189199
@@ -265,6 +275,7 @@ impl<'tcx> InstanceDef<'tcx> {
265275 pub fn has_polymorphic_mir_body ( & self ) -> bool {
266276 match * self {
267277 InstanceDef :: CloneShim ( ..)
278+ | InstanceDef :: FnPtrAddrShim ( ..)
268279 | InstanceDef :: FnPtrShim ( ..)
269280 | InstanceDef :: DropGlue ( _, Some ( _) ) => false ,
270281 InstanceDef :: ClosureOnceShim { .. }
@@ -299,6 +310,7 @@ impl<'tcx> fmt::Display for Instance<'tcx> {
299310 InstanceDef :: DropGlue ( _, None ) => write ! ( f, " - shim(None)" ) ,
300311 InstanceDef :: DropGlue ( _, Some ( ty) ) => write ! ( f, " - shim(Some({}))" , ty) ,
301312 InstanceDef :: CloneShim ( _, ty) => write ! ( f, " - shim({})" , ty) ,
313+ InstanceDef :: FnPtrAddrShim ( _, ty) => write ! ( f, " - shim({})" , ty) ,
302314 }
303315 }
304316}
0 commit comments