All function pointer types should be `Option<unsafe extern "C" fn(...) -> ...>`

Open
#5,392 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@Deepak-negi11 is already working on this.

Since Oct 10, 2026.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
65/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
tooling

Research direction

Start by reading the style.rs checks and the related examples in issue #2198 and pull request #4341. Extend the checks to enforce Option<unsafe extern "C" fn(...) -> ...> for all function pointer types, covering the nullability, safety, and calling-convention requirements described in the issue.

Written by the indexing model from the issue text.

Description

https://github.com/rust-lang/libc/issues/2198 falls into this category, and https://github.com/rust-lang/libc/pull/4341 fixes at least a subset. We should enforce this rule in the style.rs checks.

Three things here:

  1. Option because API may allow a null pointer
  2. unsafe because functions may have side effects or be invalid pointers (https://github.com/rust-lang/libc/issues/4998 for a proposal to adjust the second part)
  3. extern "C" because that's what the C side expects
Dominant language
Rust
Stars
2.6k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
27

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-lang/libc

All issues in rust-lang/libc

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.