@@ -781,6 +781,36 @@ impl<'a, 'tcx> Visitor<'tcx> for BoundVarContext<'a, 'tcx> {
781781 intravisit:: walk_ty ( this, ty) ;
782782 } ) ;
783783 }
784+ hir:: TyKind :: UnsafeBinder ( binder) => {
785+ let ( mut bound_vars, binders) : ( FxIndexMap < LocalDefId , ResolvedArg > , Vec < _ > ) =
786+ binder
787+ . generic_params
788+ . iter ( )
789+ . enumerate ( )
790+ . map ( |( late_bound_idx, param) | {
791+ (
792+ ( param. def_id , ResolvedArg :: late ( late_bound_idx as u32 , param) ) ,
793+ late_arg_as_bound_arg ( self . tcx , param) ,
794+ )
795+ } )
796+ . unzip ( ) ;
797+
798+ deny_non_region_late_bound ( self . tcx , & mut bound_vars, "function pointer types" ) ;
799+
800+ self . record_late_bound_vars ( ty. hir_id , binders) ;
801+ let scope = Scope :: Binder {
802+ hir_id : ty. hir_id ,
803+ bound_vars,
804+ s : self . scope ,
805+ scope_type : BinderScopeType :: Normal ,
806+ where_bound_origin : None ,
807+ } ;
808+ self . with ( scope, |this| {
809+ // a bare fn has no bounds, so everything
810+ // contained within is scoped within its binder.
811+ intravisit:: walk_ty ( this, ty) ;
812+ } ) ;
813+ }
784814 hir:: TyKind :: TraitObject ( bounds, lifetime, _) => {
785815 debug ! ( ?bounds, ?lifetime, "TraitObject" ) ;
786816 let scope = Scope :: TraitRefBoundary { s : self . scope } ;
0 commit comments