Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

[BUG] `af_set_backend` is declared with the wrong parameter width

未關閉 適合新手
#388 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
88/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
冷清
技術堆疊
c, rust
領域
backend

研究方向

從 src/core/backend.rs:7 開始,將 af_set_backend 與同一 extern 區塊中的相鄰宣告進行比較。檢查 include/af/backend.h:24 以確認 C enum 型別,然後更新 Rust 宣告使其與 ABI 相符,接著執行儲存庫的 Rust 檢查或測試。當該宣告使用正確的參數寬度且檢查通過時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

Bug

src/core/backend.rs:7:

extern "C" {
    fn af_set_backend(bknd: u8) -> c_int;

The C signature (include/af/backend.h:24) is:

AFAPI af_err af_set_backend(const af_backend bknd);

af_backend is a C enum, i.e. 4-byte int under both MSVC and GCC. Declaring the parameter as u8 is an ABI type mismatch.

In practice it works, because rustc emits zeroext for the u8 argument and the callee reads a clean value from the full register — I checked the IR (declare noundef i32 @af_set_backend(i8 noundef zeroext)). So this is as a latent correctness issue rather than an active bug, but it should still be c_uint to match the C ABI.

The three neighbouring declarations in the same extern block already use c_uint/c_int correctly.


Found by Claude Opus 5.

主要語言
Rust
星號
827
分支
59
PR 合併指標
30 天內沒有已合併 PR

環境準備

我們還沒有檢查這個專案的環境設定檔。先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

arrayfire/arrayfire-rust 的其他 Issue

查看 arrayfire/arrayfire-rust 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。