rust-lang / rust-lang/libc

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

Open
#5,392 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.6k
Forks
1.3k
Avg merge
1d 22h
Merged PRs (30d)
69

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

Contributor guide

Open the contributing guide

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.