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

Method alloc breaks moveit (compilation error) #1318

Closed
hfiguiere opened this issue Aug 4, 2023 · 4 comments · Fixed by #1323
Closed

Method alloc breaks moveit (compilation error) #1318

hfiguiere opened this issue Aug 4, 2023 · 4 comments · Fixed by #1323
Labels
bug Something isn't working

Comments

@hfiguiere
Copy link

hfiguiere commented Aug 4, 2023

Describe the bug
Method alloc breaks moveit (compilation error)

To Reproduce

struct DataBuf {                                                                                                                                      
    void alloc();                                                                                                                                     
};
generate!("DataBuf");

This cause the follow compilation error.

┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error[E0046]: not all trait items implemented, missing: `allocate_uninitialized_cpp_storage`
 --> /tmp/.tmpwE2POD/autocxx-ffi-default-gen.rs:1:1415
  |
1 | ...88849ba138 (this) }) } } } unsafe impl autocxx :: moveit :: MakeCppStorage for root :: DataBuf { unsafe fn free_uninitialized_cpp_stor...
  |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `allocate_uninitialized_cpp_storage` in implementation
  |
  = help: implement the missing item: `unsafe fn allocate_uninitialized_cpp_storage() -> *mut Self { todo!() }`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈

Reroducer: #1319

Expected behavior

Compiles

Additional context

hfiguiere added a commit to hfiguiere/autocxx that referenced this issue Aug 4, 2023
@AndrejOrsula
Copy link

A similar issue also occurs for the free method, resulting in a missing free_uninitialized_cpp_storage in the moveit::MakeCppStorage implementation.

Would adding a simple prefix/suffix (e.g. cxx) to the names of these methods have any undesired effects? It resolves the compilation error, but I am quite unfamiliar with this codebase. Thanks.

pub(crate) fn get_alloc_name(ty_name: &QualifiedName) -> QualifiedName {
get_name(ty_name, "alloc")
}
pub(crate) fn get_free_name(ty_name: &QualifiedName) -> QualifiedName {
get_name(ty_name, "free")
}

@adetaylor
Copy link
Collaborator

Thanks for this report, and thanks for the reproducer. I think there's a good chance that you're right and that simply calling this autocxx_alloc will do the trick. I'll try it!

I'd like to be able to accept your test case directly from #1319 but I can't do that unless you accept the CLA there (sorry.) That way you can get well deserved credit for actually submitting a test case, which is quite rare, and much appreciated. If for some reason you can't accept the CLA no worries, I will write a new test case.

@adetaylor adetaylor added the bug Something isn't working label Aug 25, 2023
@adetaylor
Copy link
Collaborator

Ah I now see your comment on #1317 that you can't sign the CLA, fair enough. Thanks for the reproducer anyway.

adetaylor added a commit that referenced this issue Aug 29, 2023
Fix badly named alloc function - fixes #1318
@AndrejOrsula
Copy link

Thank you for the fix!

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.

3 participants