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

Aperta
#268 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
compilers

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Rust
Stelle
601
Fork
34
Merge medio
1h 58m
PR unite (30g)
45

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di makepad/relax

Tutte le issue di makepad/relax

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.