Skip to content

cargo: reintroduce feature options, as a means to provide input for the interpreter #14660

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bonzini
Copy link
Collaborator

@bonzini bonzini commented May 29, 2025

Without feature options there is no way for the superproject to reconcile differences between different invocations of dependency(). Until something along the lines of #14639 is completed, this makes it almost impossible to rely on Meson's Cargo interpreter when you have more than one dependency() using Cargo subprojects.

Reintroduce feature options as they were before afd8944 ("cargo: Fix feature resolution", Meson 1.7.0). However, the Cargo interpreter also "complete" the default_options provided by _do_subproject_cargo() with all the features that were enabled via Cargo.toml. This is also useful for the meson/meson.build files, which now have access to the set of enabled features.

Note however that the generated meson.build file is not independent of enabled features, because it still hardcodes the list of dependencies.

@bonzini bonzini added the dependencies:cargo Issues related to using cargo subprojects label May 29, 2025
@bonzini bonzini requested a review from xclaesse May 29, 2025 15:49
@xclaesse
Copy link
Member

My plan was to have a global option on the rust module in the same format as the cargo cli.

@xclaesse
Copy link
Member

@xclaesse
Copy link
Member

@bonzini what do you think about #14663

@bonzini
Copy link
Collaborator Author

bonzini commented May 31, 2025

Yep, looks good. The remaining bit is to introduce parsing of the user's Cargo.toml files as well and handling of more sections like [lints]. I have some code in QEMU that can be integrated in the Cargo interpreter.

EDIT: Hmm, not so good after thinking more about it. Left a lengthy comment there.

Without feature options there is no way for the superproject to reconcile differences
between different invocations of dependency().  Reintroduce options as they were
before afd8944 ("cargo: Fix feature resolution", Meson 1.7.0), but also "complete"
the default_options provided by _do_subproject_cargo() with all the features that
were enabled via Cargo.toml.

Signed-off-by: Paolo Bonzini <[email protected]>
@bonzini bonzini force-pushed the cargo-feature-options-again branch from 913b226 to 4cb1068 Compare June 2, 2025 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies:cargo Issues related to using cargo subprojects
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants