bytecodealliance / bytecodealliance/cargo-component

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

Aperta
#263 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
593
Fork
68
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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:

```sh
 .
├──  Cargo.toml # <<< Workspace only, with members in components/* and crates/*
├──  components # <<< Minimal wrappers around ./crates/*
│ ├──  cli
│ ├──  responder
│ └── 
├──  crates
│ ├── 
└──  wit
├──  cli.wit
├──  responder.wit
└── 
```

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 :sweat_smile: .

> 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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

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.

Valutazione

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

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.