cargo/crates
bors 2d368ed844 Auto merge of #14583 - x-hgg-x:features-sat-resolver, r=Eh2406
test: add support for features in the sat resolver

### What does this PR try to resolve?

This PR implements the first step of https://github.com/rust-lang/cargo/pull/11938#issuecomment-1868426431.

### How should we test and review this PR?

The first commit does some refactorings, and the second commit updates the SAT resolver.

List of boolean variables in the SAT resolver:
* One variable representing the activation of each registry package.
* One variable representing the activation of each feature of a given registry package.
* In the `sat_resolve()` method, we create an additional representing the activation of the root package.

List of clauses in the SAT resolver:
* If a package feature is activated, then the package should be activated.
* No two packages with the same links set.
* No two semver compatible versions of the same package.
* For each package:
    - For each feature:
        - If the package feature is activated and it depends of another feature of the same package, then it is also activated.
        - If the package feature is activated and it depends of a dependency, then at least one of the compatible dependency package should be activated.
        - If the package feature is activated and it depends of a feature of a dependency, then the feature of a compatible dependency package should be activated only if the compatible dependency package is activated. If this is not a weak dependency feature, then at least one of the compatible dependency package should be activated.
    - For each dependency, if the package is activated and if the dependency is non-optional or has been activated, then at least one of the compatible dependency package and its required features should be activated.
* The root package has the same dependency clauses but has no features.

List of assumptions in the SAT resolver:
* The root package is activated.
* Old root packages from previous calls to `sat_resolve()` are deactivated. This is necessary since the proptest call `sat_resolve()` several times with a different root package using the same SAT resolver, and clauses relative to the root package are not removable.
2024-09-27 21:29:29 +00:00
..
cargo-platform chore: Make N-2 the default MSRV 2024-01-18 15:30:41 -06:00
cargo-test-macro chore: Bump MSRV to 1.81 2024-09-23 19:45:57 -05:00
cargo-test-support fix(test): Remove with_stdout/with_stderr 2024-09-23 20:44:41 -05:00
cargo-util chore: Bump MSRV to 1.81 2024-09-23 19:45:57 -05:00
cargo-util-schemas feat(toml): Add autolib 2024-09-24 11:24:24 -05:00
crates-io chore: Bump MSRV to 1.81 2024-09-23 19:45:57 -05:00
home chore(deps): update rust crate windows-sys to 0.59 2024-08-01 04:18:05 +00:00
mdman [mdman] Normalize newlines when rendering options 2024-08-19 15:02:04 -07:00
resolver-tests test: add support for features in the sat resolver 2024-09-27 22:09:32 +02:00
rustfix Apply suggestions from code review 2024-08-09 15:42:02 +02:00
semver-check chore: Remove rust-version from private packages 2024-01-18 15:24:25 -06:00
xtask-build-man fix: also build manpage for cargo.md 2024-08-01 09:00:52 -04:00
xtask-bump-check chore(bump-check): cargo-test-{support,macro} on crates.io 2024-06-17 10:09:46 -04:00
xtask-lint-docs feat: Add an xtask to generate lint documentation 2024-06-06 23:03:53 -06:00
xtask-stale-label refactor(toml): Resolve toml_edit deprecations 2024-03-15 12:00:06 -05:00