# Function cargo::core::resolver::resolve

source ·

    pub fn resolve(
        summaries: &[(Summary, ResolveOpts)],
        replacements: &[(PackageIdSpec, Dependency)],
        registry: &mut dyn Registry,
        version_prefs: &VersionPreferences,
        config: Option<&Config>,
        check_public_visible_dependencies: bool,
        max_rust_version: Option<&RustVersion>
    ) -> CargoResult<Resolve>

Expand description

Builds the list of all packages required to build the first argument.

- `summaries` - the list of package summaries along with how to resolve their features. This is a list of all top-level packages that are intended to be part of the lock file (resolve output). These typically are a list of all workspace members.

- `replacements` - this is a list of `[replace]` directives found in the root of the workspace. The list here is a `PackageIdSpec` of what to replace and a `Dependency` to replace that with. In general it’s not recommended to use `[replace]` any more and use `[patch]` instead, which is supported elsewhere.

- `registry` - this is the source from which all package summaries are loaded. It’s expected that this is extensively configured ahead of time and is idempotent with our requests to it (aka returns the same results for the same query every time). Typically this is an instance of a `PackageRegistry`.

- `version_prefs` - this represents a preference for some versions over others, based on the lock file or other reasons such as `[patch]`es.

- `config` - a location to print warnings and such, or `None` if no warnings should be printed

- `check_public_visible_dependencies` - a flag for whether to enforce the restrictions introduced in the “public & private dependencies” RFC (1977). The current implementation makes sure that there is only one version of each name visible to each package.

  But there are 2 stable ways to directly depend on different versions of the same name.

  1. Use the renamed dependencies functionality
  2. Use ‘cfg({})’ dependencies functionality

  When we have a decision for how to implement is without breaking existing functionality this flag can be removed.