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

Structs and functions with parameters/fields named "handle" are quietly not exported #35

Open
LukasBoersma opened this issue Jan 21, 2023 · 1 comment

Comments

@LukasBoersma
Copy link

Hi, I think I caught a bug in witgen. When I run cargo witgen generate on this code:

use witgen::witgen;

#[witgen]
fn works() {}

#[witgen]
fn doesnt_work(handle: i32) -> i32 { handle }

#[witgen]
struct Works { test: i32 }

#[witgen]
struct DoesntWork { handle: i32 }

Then it creates this WIT file:

// auto-generated file by witgen (https://github.com/bnjjj/witgen), please do not edit yourself, you can generate a new one thanks to cargo witgen generate command. (cargo-witgen v0.15.0) 

works: func()


record works {
  test: s32
}

The function doesnt_work and the struct DoesntWork are missing.

There is no error being reported from the cargo witgen generate command.

I am using cargo-witgen v0.15.0, the witgen crate is also v0.15.0.

@willemneal
Copy link
Collaborator

Good catch! It seems that handle is not a keyword anymore.

https://github.com/WebAssembly/component-model/blob/main/design/mvp/WIT.md

Will update soon!

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

2 participants