File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
src/tools/rust-analyzer/crates/hir/src Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1884,6 +1884,14 @@ impl Function {
18841884 Type :: from_value_def ( db, self . id )
18851885 }
18861886
1887+ pub fn fn_ptr_type ( self , db : & dyn HirDatabase ) -> Type {
1888+ let resolver = self . id . resolver ( db. upcast ( ) ) ;
1889+ let substs = TyBuilder :: placeholder_subst ( db, self . id ) ;
1890+ let callable_sig = db. callable_item_signature ( self . id . into ( ) ) . substitute ( Interner , & substs) ;
1891+ let ty = TyKind :: Function ( callable_sig. to_fn_ptr ( ) ) . intern ( Interner ) ;
1892+ Type :: new_with_resolver_inner ( db, & resolver, ty)
1893+ }
1894+
18871895 /// Get this function's return type
18881896 pub fn ret_type ( self , db : & dyn HirDatabase ) -> Type {
18891897 let resolver = self . id . resolver ( db. upcast ( ) ) ;
You can’t perform that action at this time.
0 commit comments