Cargo workspaces `core`, `alloc` imports and `macro` exports cannot be resolved

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

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
32/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
rust, wasm
Ambito
build-system, cli

Direzione di ricerca

Inizia con la struttura del workspace e l’esempio minimo riproducibile collegati nell’issue, inclusi i relativi file Cargo.toml, components/, crates/ e wit/. Confronta i bindings generati e la patch invertita nella pull request collegata, quindi verifica che gli import di core e alloc e le esportazioni delle macro vengano risolti e che il workspace compili.

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

Descrizione

It seems that composing a project with a structure like below has resolution issues that need a patch to the bindings generated to function:

 .
├──  Cargo.toml       # <<< Workspace only, with members in components/* and crates/*
├──  components       # <<< Minimal wrappers around ./crates/* 
│   ├──  cli
│   ├──  responder
│   └──  <other cargo component crates>
├──  crates
│   ├──  <pure rust crates, no wasm>
└──  wit
    ├──  cli.wit
    ├──  responder.wit
    └──  <other wit files>

Here is a minimal reproducible example with the patch I got compiling at least - note the diff is inverted so I needed the opposite change from the PR to compile: https://github.com/NukeManDan/cargo-component-workspace-bindings/pull/1 . Although I am not sure that this is the right fix, just what hacked together seems to fix cargo's complaints 😅 .

The patch here is to be more explicit in imports and a long standing weirdness of macro resolution: https://github.com/rust-lang/rust/issues/57966

Perhaps this issue would need to be transferred to https://github.com/bytecodealliance/wit-bindgen if the fix should not exist here.

Lingua principale
Rust
Stelle
593
Fork
68
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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 bytecodealliance/cargo-component

Tutte le issue di bytecodealliance/cargo-component

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.