-
Notifications
You must be signed in to change notification settings - Fork 150
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
Missing lifetime specifier in generated code #1238
Comments
Thanks, I'm traveling this week but I'll take a look next week. It would be even better if you could raise a PR with a failing integration test. |
I've been trying to figure it out. I have this command (running in an Ubuntu VM with the repo linked above):
I had to patch But this still spits out slightly over 200k lines of C++, so I assume I'm missing something. |
Thanks, yeah, autocxx-reduce (when it's working) will shrink that down to just 2-3 lines of code! However, it's quite pernickety to get working, because it has to make assumptions about your local build environment (as you noticed). Let me see if I can reproduce it using the example repo you gave. |
I can reproduce this with your provided standalone repo (thanks for doing that), I made a |
Here is the minimized test case spat out by the reduction pipeline: namespace a {
class b;
}
namespace s2e {
class c;
class f {
a::b d();
};
class S2E {
public:
f e;
a::b &d(c *) const;
};
} // namespace s2e I expect it can be trimmed down a little more by hand, but that should give me enough to work with to diagnose the problem. I'm in the middle of a few other things right now but will take a look eventually. Thanks for the report, and thanks for making it possible to get a minimal test case like this. |
I think I see what's going on here. The generated code (about which pub unsafe fn S2E_d_autocxx_wrapper_0xa21e7b0ce9f73499 (autocxx_gen_this : & S2E , arg1 : * mut c) -> Pin < & mut b > ; The code generator assumed that lifetimes could be elided in this case, but they can't, because the the input reference is |
Fixes #1238. This also takes the opportunity to: * improve diagnostics for some of the existing cases of functions rejected for reference shenanigans; * be more consistent about how we determine 'reference-ness' of return values and parameters.
Expected Behavior
There would be a lifetime specifier in the generated function
Actual Behavior
Borrowchecking error
Error log
Steps to Reproduce the Problem
generate!
the types2e::S2E
Reproduced in this repo
Specifications
The text was updated successfully, but these errors were encountered: