bytecodealliance / bytecodealliance/cargo-component

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

Open
#263 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
593
Forks
68
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.