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

Externally defined steps not included in binary #304

Closed
yds12 opened this issue Sep 28, 2023 · 4 comments
Closed

Externally defined steps not included in binary #304

yds12 opened this issue Sep 28, 2023 · 4 comments
Assignees
Labels
bug Something isn't working k::design Related to overall design and/or architecture question Further information is requested

Comments

@yds12
Copy link

yds12 commented Sep 28, 2023

I have a kinda complicated setup, so it would be hard to provide a minimal reproducible version, but I'll try to describe it.

In summary, I have a wrapper around cucumber, and various crates that define their own steps, using this wrapper for the World implementation. This most of the time works fine, and I'm able to create a runner crate that uses all of those crates, and use the steps defined on them, but in some occasions, which I could not fully identify, I noticed that the steps are simply not included in the compiled binary. I get the step doesn't match any function error.

There was one occasion where compiling in release or debug mode would yield different results: one of them had the steps, the other didn't (I don't recall which was which, but I'd assume it could happen that the release mode compilation removed the steps as an optimization?).

I inspected the binary using unix's string utility (parts of strings used in the step names should be visible in the binary as they are static), but could not find any trace of those steps.

I suspect this has to do with the way steps are registered via the inventory crate. That crate says something about calls to collect! being in the same crate that defines the plugin type. Not sure if this is the issue here.

Just opening this to raise awareness of this issue, I cannot easily reproduce it, it just happens in certain situations involving multiple crates defining steps.

@tyranron tyranron added the bug Something isn't working label Sep 28, 2023
@tyranron tyranron self-assigned this Sep 28, 2023
@tyranron tyranron added time sink You may lose your mind if you try to fix this, but I won't stop you k::design Related to overall design and/or architecture labels Sep 28, 2023
@tyranron
Copy link
Member

@yds12 this is something we're dependent on inventory for. Not sure, we can do something about it from our side, because the way we're using inventory is quite trivial, no shenanigans at all.

Can you also specify at which platform does this happen?

Also, try codegen-units = 1 for this, it has helped us many times with inventory.

@tyranron tyranron added the question Further information is requested label Sep 28, 2023
@yds12
Copy link
Author

yds12 commented Sep 29, 2023

Hi @tyranron, thanks for the reply. I have only observed this bug in MacOS (Ventura). I'll try your suggestion later today and let you know in case it works.

@yds12
Copy link
Author

yds12 commented Oct 9, 2023

The suggestion to use codegen-units = 1 solved the issue for me. Thank you!

@tyranron tyranron removed the time sink You may lose your mind if you try to fix this, but I won't stop you label Oct 9, 2023
@tyranron
Copy link
Member

tyranron commented Oct 9, 2023

Closing this, as resolving it is up to upstream: dtolnay/inventory#52

@tyranron tyranron closed this as completed Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working k::design Related to overall design and/or architecture question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants