E0603 on a registry dependency that re-exports a proc macro under a private module's name

オープン
#268 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

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

調査の方向性

Start at libs/relax/front/src/program/privacy.rs:68, where the visibility check already has the macro case, and follow it into lookup_macro_in_container (libs/relax/front/src/program.rs:5322), which reads only mods[d.sub].macros; that map is filled for exported macro_rules! at libs/relax/front/src/program.rs:3444 but apparently not for pub use-re-exported proc macros. Build the repro crate from the issue and run relax check on it, then compare with the path-dependency control, which works, to find where the registry seeding path drops the re-export. Done means the repro checks cleanly and existing macro-resolution tests still pass.

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

説明

On Relax 953d174a (macOS arm64), relax check rejects a use of a re-exported proc macro when the exporting crate also has a private module of that name. rustc accepts it.

Reproduce

Cargo.toml

[package]
name = "repro-e0603"
version = "0.1.0"
edition = "2024"

[workspace]

[dependencies]
rutis = "0.23.0"

src/main.rs

use rutis::service;

fn main() {}
cargo generate-lockfile        # relax requires a lockfile
relax check repro-e0603

Expected: no error (rustc 1.100 reports only unused_imports).

Actual:

src/main.rs:1:1: E0603: module `service` is private

rutis 0.23.0 has both a private module and a public re-export of the attribute macro under the same name:

  • src/lib.rs:60: mod service;
  • src/lib.rs:81: pub use rutis_macros::service;

Where it points

libs/relax/front/src/program/privacy.rs:68 already has a case for exactly this:

let mut visible = last && in_use && last_ns.is_none() && self.lookup_macro_in_container(cur, name);

lookup_macro_in_container (libs/relax/front/src/program.rs:5322) only checks mods[d.sub].macros. That map is filled for exported macro_rules! at libs/relax/front/src/program.rs:3444, but a pub use-re-exported proc macro is not registered there, so the private mod service wins.

Control

The same shape as a path dependency does not reproduce: a local crate with mod service; + pub use local_macro::service;, imported as use local_crate::service;, checks cleanly. So the missing binding looks specific to registry crates (the seeding/demand path), not to use resolution in general.

主要言語
Rust
スター
601
フォーク
34
平均マージ
1時間 58分
マージ済み PR(30日)
45

環境構築

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

はじめの一歩

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

makepad/relax のほかの issue

makepad/relax の issue をすべて見る

似ている issue

Rust の issue をもっと見る

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

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