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

Support specifying version for macro expansion. #928

Conversation

alilleybrinker
Copy link

See: #900.

Previously, cbindgen might sometimes match the wrong version of a crate
if the crate occurs multiple times in the dependency list produced by
cargo metadata. This meant that you'd observe transient errors where
sometimes the right output would be produced (when the intended
version is macro-expanded), and sometimes it would not (when the wrong
version is macro-expanded).

This commit modifies the configuration to permit optionally specifying
name and version separately instead of solely specifying version.

This is an initial draft, as I have not yet been able to test it.

Signed-off-by: Andrew Lilley Brinker alilleybrinker@gmail.com

See: [mozilla#900].

Previously, cbindgen might sometimes match the wrong version of a crate
if the crate occurs multiple times in the dependency list produced by
`cargo metadata`. This meant that you'd observe transient errors where
_sometimes_ the right output would be produced (when the intended
version is macro-expanded), and sometimes it would not (when the wrong
version is macro-expanded).

This commit modifies the configuration to permit optionally specifying
name and version separately instead of solely specifying version.

This is an initial draft, as I have not yet been able to test it.

[mozilla#900]: mozilla#900

Signed-off-by: Andrew Lilley Brinker <alilleybrinker@gmail.com>
@alilleybrinker alilleybrinker changed the title feat: support specifying version for expansion. Support specifying version for expansion. Feb 15, 2024
@alilleybrinker alilleybrinker changed the title Support specifying version for expansion. Support specifying version for macro expansion. Feb 15, 2024
@alilleybrinker
Copy link
Author

Some quick testing of mine showed that on initial run this patch did appear to cause just the correct version to be selected, but for some reason if run again it resulted in failure. I haven't yet been able to debug why that is. Suffice to say, this patch is not yet a sufficient solution.

@alilleybrinker
Copy link
Author

I'm actually going to close this out. I figured out a way to work around this issue for my own use case, and it doesn't make sense to further pursue work on this patch. The patch doesn't currently work.

That said, if someone else wants to take this and do something with it, feel free!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant