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

ABI generation fails with Self arg types #1000

Closed
miraclx opened this issue Jan 21, 2023 · 0 comments · Fixed by #1001
Closed

ABI generation fails with Self arg types #1000

miraclx opened this issue Jan 21, 2023 · 0 comments · Fixed by #1001

Comments

@miraclx
Copy link
Contributor

miraclx commented Jan 21, 2023

#[near_bindgen]
#[derive(Serialize, Deserialize)]
struct MyType {
    data: u8,
}

#[near_bindgen]
impl MyType {
    fn set_state(&mut self, new_state: Self) {
        std::mem::replace(self, new_state);
    }
}
$ cargo build --features near-sdk/__abi-generate
   Compiling adder v0.1.0 (/Users/miraclx/git/near/near-sdk-rs/examples/adder)
error[E0308]: mismatched types
  --> src/lib.rs:12:1
   |
12 | #[near_bindgen]
   | ^^^^^^^^^^^^^^^ expected struct `Input`, found struct `MyTypeExt`
   |
   = note: expected reference `&Input<'_>`
              found reference `&MyTypeExt`
   = note: this error originates in the attribute macro `near_bindgen` (in Nightly builds, run with -Z macro-backtrace for more info)

Some errors have detailed explanations: E0308, E0411.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `adder` due to 4 previous errors
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 a pull request may close this issue.

1 participant