ObjC selector with $ panics ("take$foo" is not a valid Ident)

オープン 初心者向け
#3,483 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
objective-c, rust
領域
tooling

調査の方向性

bindgen/ir/objc.rs の format_method_call と、264 行目付近で報告された panic から始めます。提供された Objective-C ヘッダーと bindgen の呼び出しを使って問題を再現し、その後、$ を含む selector フラグメントで abort が発生しなくなり、期待される出力と一貫した形で mangling されることを確認します。

索引モデルが issue の本文から書いたものです。

説明

Input C/C++ Header
__attribute__((objc_root_class))
@interface Foo
- (int)take$foo:(int)t;
@end
Bindgen Invocation
$ bindgen input.h -- -x objective-c
Actual Results

bindgen aborts:

panicked at bindgen/ir/objc.rs:264:30:
"take$foo" is not a valid Ident

clang accepts $ in the selector. C names with $ already go through rust_mangle ($ → _). ObjC format_method_call passes selector fragments to Ident::new / syn::parse_str without that.

This is not #2486 (keyword type / self) or #1703 (empty :: fragments).

Expected Results

Do not abort. Mangle $ in selector fragments the same way C identifiers are mangled.

Environment
bindgen: 0.73.1 (rust-lang/rust-bindgen 77cbc723)
clang/libclang: Homebrew clang 21.1.8
rustc: 1.97.1
target: aarch64-apple-darwin
OS: macOS
主要言語
Rust
スター
5.3k
フォーク
846
平均マージ
2日 6時間
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

rust-lang/rust-bindgen のほかの issue

rust-lang/rust-bindgen の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。