We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Function::fn_ptr_type(…)
1 parent c1b0516 commit 88f125eCopy full SHA for 88f125e
src/tools/rust-analyzer/crates/hir/src/lib.rs
@@ -1884,6 +1884,14 @@ impl Function {
1884
Type::from_value_def(db, self.id)
1885
}
1886
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
+
1895
/// Get this function's return type
1896
pub fn ret_type(self, db: &dyn HirDatabase) -> Type {
1897
let resolver = self.id.resolver(db.upcast());
0 commit comments