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

Bug when defining methods on shared structs #442

Closed
XiangpengHao opened this issue Nov 10, 2020 · 1 comment · Fixed by #443
Closed

Bug when defining methods on shared structs #442

XiangpengHao opened this issue Nov 10, 2020 · 1 comment · Fixed by #443
Labels

Comments

@XiangpengHao
Copy link
Contributor

// str_test.rs
#[cxx::bridge]
mod ffi {
    struct A {
        a: f32,
    }

    extern "Rust"{
        fn hello(self: &A) -> String;
    }
}

Then run

cxxbridge str_test.rs

We get:

...

::rust::String A::hello() const noexcept {
  ::rust::MaybeUninit<::rust::String> return$;
  cxxbridge05$A$hello(*this&return$.value);
  return ::std::move(return$.value);
}

Note that there's a missing "," in hello invocation.
It should be cxxbridge05$A$hello(*this, &return$.value); instead of cxxbridge05$A$hello(*this&return$.value);

@XiangpengHao XiangpengHao changed the title Bug on methods on shared structs Bug when defining methods on shared structs Nov 10, 2020
@dtolnay
Copy link
Owner

dtolnay commented Nov 10, 2020

Thanks, fixed in 0.5.7.

@dtolnay dtolnay added the bug label Dec 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants