Skip to content

Commit b45ca32

Browse files
committed
refactor(source): Rename AlternativeVersions to RejectedVersions
Really, when we switch the req to a wildcard, it is an alternative version, so for yanked and unsupported we need a different name.
1 parent ad5b493 commit b45ca32

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

crates/resolver-tests/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ pub fn resolve_with_global_context_raw(
143143
for summary in self.list.iter() {
144144
let matched = match kind {
145145
QueryKind::Exact => dep.matches(summary),
146-
QueryKind::AlternativeVersions => dep.matches(summary),
146+
QueryKind::RejectedVersions => dep.matches(summary),
147147
QueryKind::AlternativeNames => true,
148148
QueryKind::Normalized => true,
149149
};

src/cargo/core/resolver/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ pub(super) fn activation_error(
305305
} else {
306306
// Maybe something is wrong with the available versions
307307
let mut version_candidates = loop {
308-
match registry.query_vec(&new_dep, QueryKind::AlternativeVersions) {
308+
match registry.query_vec(&new_dep, QueryKind::RejectedVersions) {
309309
Poll::Ready(Ok(candidates)) => break candidates,
310310
Poll::Ready(Err(e)) => return to_resolve_err(e),
311311
Poll::Pending => match registry.block_until_ready() {

src/cargo/sources/directory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'gctx> Source for DirectorySource<'gctx> {
108108
}
109109
let packages = self.packages.values().map(|p| &p.0);
110110
let matches = packages.filter(|pkg| match kind {
111-
QueryKind::Exact | QueryKind::AlternativeVersions => dep.matches(pkg.summary()),
111+
QueryKind::Exact | QueryKind::RejectedVersions => dep.matches(pkg.summary()),
112112
QueryKind::AlternativeNames => true,
113113
QueryKind::Normalized => dep.matches(pkg.summary()),
114114
});

src/cargo/sources/path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl<'gctx> Source for PathSource<'gctx> {
145145
self.load()?;
146146
if let Some(s) = self.package.as_ref().map(|p| p.summary()) {
147147
let matched = match kind {
148-
QueryKind::Exact | QueryKind::AlternativeVersions => dep.matches(s),
148+
QueryKind::Exact | QueryKind::RejectedVersions => dep.matches(s),
149149
QueryKind::AlternativeNames => true,
150150
QueryKind::Normalized => dep.matches(s),
151151
};
@@ -332,7 +332,7 @@ impl<'gctx> Source for RecursivePathSource<'gctx> {
332332
.map(|p| p.summary())
333333
{
334334
let matched = match kind {
335-
QueryKind::Exact | QueryKind::AlternativeVersions => dep.matches(s),
335+
QueryKind::Exact | QueryKind::RejectedVersions => dep.matches(s),
336336
QueryKind::AlternativeNames => true,
337337
QueryKind::Normalized => dep.matches(s),
338338
};

src/cargo/sources/registry/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ impl<'gctx> Source for RegistrySource<'gctx> {
799799
.index
800800
.query_inner(dep.package_name(), &req, &mut *self.ops, &mut |s| {
801801
let matched = match kind {
802-
QueryKind::Exact | QueryKind::AlternativeVersions => {
802+
QueryKind::Exact | QueryKind::RejectedVersions => {
803803
if req.is_precise() && self.gctx.cli_unstable().unstable_options {
804804
dep.matches_prerelease(s.as_summary())
805805
} else {
@@ -816,7 +816,7 @@ impl<'gctx> Source for RegistrySource<'gctx> {
816816
// leak through if they're in a whitelist (aka if they were
817817
// previously in `Cargo.lock`
818818
match s {
819-
s @ _ if kind == QueryKind::AlternativeVersions => callback(s),
819+
s @ _ if kind == QueryKind::RejectedVersions => callback(s),
820820
s @ IndexSummary::Candidate(_) => callback(s),
821821
s @ IndexSummary::Yanked(_) => {
822822
if self.yanked_whitelist.contains(&s.package_id()) {

src/cargo/sources/source.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ pub enum QueryKind {
184184
///
185185
/// Path/Git sources may return all dependencies that are at that URI,
186186
/// whereas an `Registry` source may return dependencies that are yanked or invalid.
187-
AlternativeVersions,
187+
RejectedVersions,
188188
/// A query for packages close to the given dependency requirement.
189189
///
190190
/// Each source gets to define what `close` means for it.

0 commit comments

Comments
 (0)