Skip to content

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

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.

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