Skip to content

Commit

Permalink
Merge #2587
Browse files Browse the repository at this point in the history
2587: Absolute import of `Result` in derive r=syrusakbary a=ureeves

# Description

When aliasing `Result` deriving `WasmerEnv` is not possible. See a minimal example of the problem below.

```rust
use wasmer::WasmerEnv;

struct Error;
type Result<T> = core::result::Result<T, Error>;

#[derive(WasmerEnv, Clone)]
struct MyEnv; // error[E0107] this type alias takes 1 generic
              // argument but 2 generic arguments were supplied
```

# Review

- [x] Add a short description of the change to the CHANGELOG.md file


Co-authored-by: Eduardo Leegwater Simões <[email protected]>
  • Loading branch information
bors[bot] and ureeves authored Sep 29, 2021
2 parents f566c30 + 24595b5 commit 2f33785
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Looking for changes that affect our C API? See the [C API Changelog](lib/c-api/C
- [#2478](https://github.com/wasmerio/wasmer/pull/2478) Rename `wasm_instance_new()`’s “traps” argument to “trap”.

### Fixed
- [#2587](https://github.com/wasmerio/wasmer/pull/2587) Fixed deriving `WasmerEnv` when aliasing `Result`.
- [#2518](https://github.com/wasmerio/wasmer/pull/2518) Remove temporary file used to creating an artifact when creating a Dylib engine artifact.
- [#2494](https://github.com/wasmerio/wasmer/pull/2494) Fixed `WasmerEnv` access when using `call_indirect` with the Singlepass compiler.
- [#2449](https://github.com/wasmerio/wasmer/pull/2449) Fixed `wasmer-c-api` used `soname`.
Expand Down
4 changes: 2 additions & 2 deletions lib/derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fn impl_wasmer_env(input: &DeriveInput) -> TokenStream {

set_dummy(quote! {
impl ::wasmer::WasmerEnv for #struct_name {
fn init_with_instance(&mut self, instance: &::wasmer::Instance) -> Result<(), ::wasmer::HostEnvInitError> {
fn init_with_instance(&mut self, instance: &::wasmer::Instance) -> ::core::result::Result<(), ::wasmer::HostEnvInitError> {
Ok(())
}
}
Expand Down Expand Up @@ -205,7 +205,7 @@ fn derive_struct_fields(data: &DataStruct) -> (TokenStream, TokenStream) {
}

let trait_methods = quote! {
fn init_with_instance(&mut self, instance: &::wasmer::Instance) -> Result<(), ::wasmer::HostEnvInitError> {
fn init_with_instance(&mut self, instance: &::wasmer::Instance) -> ::core::result::Result<(), ::wasmer::HostEnvInitError> {
#(#finish)*
Ok(())
}
Expand Down

0 comments on commit 2f33785

Please sign in to comment.