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

Should autocxx::c_* newtypes implement Copy? #580

Closed
WilliamVenner opened this issue Aug 8, 2021 · 1 comment · Fixed by #581
Closed

Should autocxx::c_* newtypes implement Copy? #580

WilliamVenner opened this issue Aug 8, 2021 · 1 comment · Fixed by #581
Labels
bug Something isn't working

Comments

@WilliamVenner
Copy link

Hi,

I noticed that the wrapped C types autocxx exposes do not implement Copy - only Clone, despite most of them having Copy implemented on the underlying type - is this intentional?

autocxx/src/lib.rs

Lines 620 to 633 in 4e96dfd

macro_rules! ctype_wrapper {
($r:ident, $c:expr, $d:expr) => {
#[doc=$d]
#[derive(Debug, Eq, Clone, PartialEq, Hash)]
#[allow(non_camel_case_types)]
#[repr(transparent)]
pub struct $r(pub ::std::os::raw::$r);
unsafe impl autocxx_engine::cxx::ExternType for $r {
type Id = autocxx_engine::cxx::type_id!($c);
type Kind = autocxx_engine::cxx::kind::Trivial;
}
};
}

Cheers

@adetaylor
Copy link
Collaborator

Thanks for the report. These autocxx::c_* types were intended to be a stop-gap measure until dtolnay/cxx#874 lands, which in turn is blocked on dtolnay/cxx#682. There's progress there in dtolnay/cxx#908 thanks to @CAD97 so hopefully these nasty wrappers can go away soon.

However! Meanwhile yes they should probably implement Copy. I'll make that change.

@adetaylor adetaylor added the bug Something isn't working label Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants