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

Fix macros std pollution in feature resolution #164

Merged
merged 2 commits into from
Jul 5, 2022

Conversation

leighmcculloch
Copy link
Member

What

Exclude the stellar-contract-macros crate from the virtual workspace.

Why

When building a lib crate that has a dependency on a proc_macro crate, and where both crates depend on a common dependency with different feature sets The features required by the lib and proc_macro crates get unified when the whole workspace is built together, even with resolver = 2 set.

When building the lib crate in isolation, or excluding the proc-macro crate from the virtual workspace, the features required by the lib and proc_macro creates are decoupled and do not impact each other.

See rust-lang/cargo#10827

Known limitations

If we ever add tests directly to the stellar-contract-macros crate they will not execute as part of running tests for the whole workspace. This is unlikely to be a real problem since to test the macro completely the tests need to be part of the stellar-contract-sdk, so we're unlikely to write tests in the macros crate.

@leighmcculloch leighmcculloch merged commit 987cded into main Jul 5, 2022
@leighmcculloch leighmcculloch deleted the fix-proc-macro-std-pollution branch July 5, 2022 22:17
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.

Address cargo feature resolution of std with rs-stellar-xdr usage in macros
1 participant