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

Can't use Vec<shared type from another module> #535

Closed
alexeyr opened this issue Nov 30, 2020 · 3 comments · Fixed by #541
Closed

Can't use Vec<shared type from another module> #535

alexeyr opened this issue Nov 30, 2020 · 3 comments · Fixed by #541
Labels

Comments

@alexeyr
Copy link

alexeyr commented Nov 30, 2020

Consider this slight modification of #297 (comment):

#[cxx::bridge(namespace = "my_usage::ffi")]
mod ffi {
    #[namespace = "zx::ffi"]
    extern "C++" {
        include!("cxx-handles-demo/src/handle.rs.h");
        type Job = crate::handle::ffi::Job;
        type Process = crate::handle::ffi::Process;
    }

    extern "Rust" {
        fn create_processes(name: &CxxString, job: &Job) -> Vec<Process>;
    }
}

In 1.0.8 it says Rust Vec containing C++ type is not supported yet (at least it does in my morally equivalent example).

@dtolnay dtolnay added the bug label Dec 1, 2020
@dtolnay
Copy link
Owner

dtolnay commented Dec 1, 2020

This is a bug -- this shouldn't happen for types that have a = crate::path::to::Definition, and where the corresponding ExternType impl has Kind=Trivial (as is the case for all shared structs).

@alexeyr
Copy link
Author

alexeyr commented Dec 1, 2020

Do you need a reproducing example (unfortunately, quite large at the moment, but I could try to minimize it)?

@dtolnay
Copy link
Owner

dtolnay commented Dec 1, 2020

Nope, this is fine. Thanks!

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