Skip to content

Commit 2380199

Browse files
committed
docs: fix links
1 parent 782f339 commit 2380199

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

src/solver.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ pub fn resolve<P: Package, VS: VersionSet>(
203203
}
204204

205205
/// An enum used by [DependencyProvider] that holds information about package dependencies.
206-
/// For each [Package] there is a [Range] of concrete versions it allows as a dependency.
206+
/// For each [Package] there is a set of versions allowed as a dependency.
207207
#[derive(Clone)]
208208
pub enum Dependencies<P: Package, VS: VersionSet> {
209209
/// Package dependencies are unavailable.
@@ -219,7 +219,7 @@ pub trait DependencyProvider<P: Package, VS: VersionSet> {
219219
/// is the process of choosing the next package
220220
/// and version that will be appended to the partial solution.
221221
/// Every time such a decision must be made,
222-
/// potential valid packages and version ranges are preselected by the resolver,
222+
/// potential valid packages and sets of versions are preselected by the resolver,
223223
/// and the dependency provider must choose.
224224
///
225225
/// The strategy employed to choose such package and version

src/type_aliases.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ pub type Map<K, V> = rustc_hash::FxHashMap<K, V>;
99
/// from [DependencyConstraints].
1010
pub type SelectedDependencies<P, V> = Map<P, V>;
1111

12-
/// Subtype of [Dependencies] which holds information about
13-
/// all possible versions a given package can accept.
14-
/// There is a difference in semantics between an empty [Map<P, Range<V>>](Map)
12+
/// Holds information about all possible versions a given package can accept.
13+
/// There is a difference in semantics between an empty map
1514
/// inside [DependencyConstraints] and [Dependencies::Unknown](crate::solver::Dependencies::Unknown):
1615
/// the former means the package has no dependencies and it is a known fact,
17-
/// while the latter means they could not be fetched by [DependencyProvider].
16+
/// while the latter means they could not be fetched by [DependencyProvider](crate::solver::DependencyProvider).
1817
pub type DependencyConstraints<P, VS> = Map<P, VS>;

src/version_set.rs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
11
// SPDX-License-Identifier: MPL-2.0
22

3-
//! Ranges are constraints defining sets of versions.
3+
//! As its name suggests, the [VersionSet] trait describes sets of versions.
44
//!
5-
//! Concretely, those constraints correspond to any set of versions
6-
//! representable as the concatenation, union, and complement
7-
//! of the ranges building blocks.
5+
//! One needs to define
6+
//! - the associate type for versions,
7+
//! - two constructors for the empty set and a singleton set,
8+
//! - the complement and intersection set operations,
9+
//! - and a function to evaluate membership of versions.
810
//!
9-
//! Those building blocks are:
10-
//! - [none()](Range::none): the empty set
11-
//! - [any()](Range::any): the set of all possible versions
12-
//! - [exact(v)](Range::exact): the set containing only the version v
13-
//! - [higher_than(v)](Range::higher_than): the set defined by `v <= versions`
14-
//! - [strictly_lower_than(v)](Range::strictly_lower_than): the set defined by `versions < v`
15-
//! - [between(v1, v2)](Range::between): the set defined by `v1 <= versions < v2`
11+
//! Two functions are automatically derived, thanks to the mathematical properties of sets.
12+
//! You can overwrite those implementations, but we highly recommend that you don't,
13+
//! except if you are confident in a correct implementation that brings much performance gains.
14+
//!
15+
//! It is also extremely important that the `Eq` trait is correctly implemented.
16+
//! In particular, you can only use `#[derive(Eq, PartialEq)]` if `Eq` is strictly equivalent to the
17+
//! structural equality, i.e. if versions have canonical representations.
18+
//! Such problems may arise if your implementations of `complement()` and `intersection()` do not
19+
//! return canonical representations so be careful there.
1620
1721
use std::fmt::{Debug, Display};
1822

0 commit comments

Comments
 (0)