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

Add async example to bindgen_examples #9822

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ifsheldon
Copy link

Closes #9776

I reused most of example 4 to avoid extra complication. Also adds a reference to code example wasi_async, so it'd better if this gets merged after #9788.

cc @alexcrichton

@ifsheldon ifsheldon requested a review from a team as a code owner December 14, 2024 15:12
@ifsheldon ifsheldon requested review from fitzgen and removed request for a team December 14, 2024 15:12
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Dec 14, 2024
@alexcrichton
Copy link
Member

Thanks, and looks good to me! I think there's some errors on CI though?

@ifsheldon
Copy link
Author

Can you take a look into the clippy error please? The error seems to originate from bindgen!. I suspect that some code in bindgen! forgets to import Box when a WIT spec is inlined. In my own example that imports from a WIT file, there's no problem. In the example 4 where async is not used, it's also fine. I have no clue why that happened. The difference between _7_async.rs and _4_imported_resources.rs is just the line async: true,

@alexcrichton
Copy link
Member

Ah I believe this is exposing a preexisting bug in the bindgen! macro, notably the async output is not compatible with #![no_std] crates. The wasmtime crate itself is such a crate which is where this is coming from.

I'm not sure of a way to work around this other than fixing the issue at hand (tracking down the Box and importing it from wasmtime::component::__internal::Box)

@ifsheldon
Copy link
Author

I think for the purpose of documentation, it's okay to let clippy skip this file.

this is exposing a preexisting bug in the bindgen! macro, notably the async output is not compatible with #![no_std] crates. The wasmtime crate itself is such a crate which is where this is coming from.

IIUC, #9823 maybe unblock this?

I'm not sure of a way to work around this other than fixing the issue at hand

Can you try to fix this please? I'm not very familiar proc_macros or bindgen internals.

@alexcrichton
Copy link
Member

Yes #9823 would probably help. Unfortunately I don't have time right now to fix this myself, and this can't land unless it's passing CI.

@ifsheldon
Copy link
Author

OK...... Can you find the issue tracking the "preexisting bug" you mentioned? I can't find one to link here. Or, I can file a new one.

@alexcrichton
Copy link
Member

I don't believe there's a preexisting issue since this is I think the first time it's come up, but feel free to file an issue of course

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:api Related to the API of the `wasmtime` crate itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing examples for using bindgen! async, imports and resource in host
2 participants