cpubits: single 16 => { ... } macro arm fails expansion with error: no rules expected ','

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

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

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

評価

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

調査の方向性

まず crate cpubits 内のマクロ cpubits! の定義を見つけ、16 => { ... } の展開経路を、動作する単一分岐形式の 32 および 64 と比較してください。Issue の再現例を最初にコンパイルします。再現例がコンパイルでき、列挙されている動作する形式も引き続きコンパイルできれば完了です。

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

説明

Component

cpubits (v0.1.1)

Description

Calling the cpubits! macro with only the 16-bit branch (single 16) fails to expand at compile time with a syntax error. Other single-branch forms (32 => { ... } and 64 => { ... }), pairs, and the full triple compile as expected.

Minimal Reproduction Example
use cpubits::cpubits;

cpubits! {
    16 => {
        pub type Word = u16;
    }
}

fn main() {}
Compiler Output
error: no rules expected `,`
 --> src/main.rs:3:1
  |
3 | / cpubits! {
4 | |     16 => {
5 | |         pub type Word = u16;
6 | |     }
7 | | }
  | |_^ no rules expected this token in macro call
  |
  = note: this error originates in the macro `cpubits::cpubits`
Root Cause

During macro expansion of the single 16 => { ... } pattern, the macro inserts a comma after its first generated branch, but the internal two-branch/downstream matcher in cpubits! does not accept a comma at that position.

Observed shapes probe results:

  • single16: ❌ exit 1 (error: no rules expected ',')
  • single32: ✅ exit 0
  • single64: ✅ exit 0
  • group16_32: ✅ exit 0
  • group32_64: ✅ exit 0
  • pair16_32: ✅ exit 0
  • pair32_64: ✅ exit 0
  • triple: ✅ exit 0
主要言語
Rust
スター
688
フォーク
177
平均マージ
2時間 31分
マージ済み PR(30日)
31

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

RustCrypto/utils のほかの issue

RustCrypto/utils の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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