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

adds stubwasi.rs #111

Merged
merged 3 commits into from
Oct 28, 2024
Merged

adds stubwasi.rs #111

merged 3 commits into from
Oct 28, 2024

Conversation

philrhc
Copy link
Contributor

@philrhc philrhc commented Oct 21, 2024

factors wasi stubbing out of lib.rs into a new file

Comment on lines -292 to -294
if stub_wasi {
add_wasi_imports(module, &mut wasi_imports)?;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i moved this inside the if stub_wasi block below, since looping through the libraries to add libraries is done (again?) there

src/stubwasi.rs Outdated Show resolved Hide resolved
Copy link
Collaborator

@dicej dicej left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! LGTM, except seem my comment about the unwraps.

src/stubwasi.rs Outdated Show resolved Hide resolved
fn add_wasi_imports<'a>(
module: &'a [u8],
imports: &mut HashMap<&'a str, HashMap<&'a str, FuncType>>,
) -> Result<()> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm confused why Result<(), Error> is not required here

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're useing anyhow::Result, the second generic parameter of which has a default of anyhow::Error, so it doesn't need to be specified explicitly.

@dicej dicej merged commit 117b1bc into bytecodealliance:main Oct 28, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants