Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nuke-web3 opened this issue Mar 18, 2024 · 0 comments
Open

Comments

@nuke-web3
Copy link

nuke-web3 commented Mar 18, 2024

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: nuke-web3/cargo-component-workspace-bindings#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: rust-lang/rust#57966

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

@nuke-web3 nuke-web3 changed the title Cargo workspaces core and alloc imports and macro exports cannot be resolved Cargo workspaces core, alloc imports and macro exports cannot be resolved Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant