@@ -96,6 +96,13 @@ pub enum InstanceDef<'tcx> {
9696 ///
9797 /// The `DefId` is for `Clone::clone`, the `Ty` is the type `T` with the builtin `Clone` impl.
9898 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 > ) ,
99106}
100107
101108impl < ' tcx > Instance < ' tcx > {
@@ -151,7 +158,8 @@ impl<'tcx> InstanceDef<'tcx> {
151158 | InstanceDef :: Intrinsic ( def_id)
152159 | InstanceDef :: ClosureOnceShim { call_once : def_id, track_caller : _ }
153160 | InstanceDef :: DropGlue ( def_id, _)
154- | InstanceDef :: CloneShim ( def_id, _) => def_id,
161+ | InstanceDef :: CloneShim ( def_id, _)
162+ | InstanceDef :: FnPtrAddrShim ( def_id, _) => def_id,
155163 }
156164 }
157165
@@ -167,7 +175,8 @@ impl<'tcx> InstanceDef<'tcx> {
167175 | InstanceDef :: Intrinsic ( ..)
168176 | InstanceDef :: ClosureOnceShim { .. }
169177 | InstanceDef :: DropGlue ( ..)
170- | InstanceDef :: CloneShim ( ..) => None ,
178+ | InstanceDef :: CloneShim ( ..)
179+ | InstanceDef :: FnPtrAddrShim ( ..) => None ,
171180 }
172181 }
173182
@@ -182,7 +191,8 @@ impl<'tcx> InstanceDef<'tcx> {
182191 | InstanceDef :: Intrinsic ( def_id)
183192 | InstanceDef :: ClosureOnceShim { call_once : def_id, track_caller : _ }
184193 | 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) ,
186196 }
187197 }
188198
@@ -268,6 +278,7 @@ impl<'tcx> InstanceDef<'tcx> {
268278 pub fn has_polymorphic_mir_body ( & self ) -> bool {
269279 match * self {
270280 InstanceDef :: CloneShim ( ..)
281+ | InstanceDef :: FnPtrAddrShim ( ..)
271282 | InstanceDef :: FnPtrShim ( ..)
272283 | InstanceDef :: DropGlue ( _, Some ( _) ) => false ,
273284 InstanceDef :: ClosureOnceShim { .. }
@@ -306,6 +317,7 @@ fn fmt_instance(
306317 InstanceDef :: DropGlue ( _, None ) => write ! ( f, " - shim(None)" ) ,
307318 InstanceDef :: DropGlue ( _, Some ( ty) ) => write ! ( f, " - shim(Some({}))" , ty) ,
308319 InstanceDef :: CloneShim ( _, ty) => write ! ( f, " - shim({})" , ty) ,
320+ InstanceDef :: FnPtrAddrShim ( _, ty) => write ! ( f, " - shim({})" , ty) ,
309321 }
310322}
311323
0 commit comments