mirror of https://github.com/rust-lang/cargo
feat(resolve): Fallback to 'rustc -V' for MSRV resolving
This commit is contained in:
parent
b7b3874d09
commit
38718eaa93
|
@ -73,7 +73,6 @@ use crate::util::cache_lock::CacheLockMode;
|
||||||
use crate::util::errors::CargoResult;
|
use crate::util::errors::CargoResult;
|
||||||
use crate::util::CanonicalUrl;
|
use crate::util::CanonicalUrl;
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
use cargo_util_schemas::manifest::RustVersion;
|
|
||||||
use std::collections::{HashMap, HashSet};
|
use std::collections::{HashMap, HashSet};
|
||||||
use tracing::{debug, trace};
|
use tracing::{debug, trace};
|
||||||
|
|
||||||
|
@ -304,8 +303,14 @@ pub fn resolve_with_previous<'gctx>(
|
||||||
version_prefs.version_ordering(VersionOrdering::MinimumVersionsFirst)
|
version_prefs.version_ordering(VersionOrdering::MinimumVersionsFirst)
|
||||||
}
|
}
|
||||||
if ws.resolve_honors_rust_version() {
|
if ws.resolve_honors_rust_version() {
|
||||||
let rust_version = ws.rust_version().cloned().map(RustVersion::into_partial);
|
let rust_version = if let Some(ver) = ws.rust_version() {
|
||||||
version_prefs.max_rust_version(rust_version);
|
ver.clone().into_partial()
|
||||||
|
} else {
|
||||||
|
let rustc = ws.gctx().load_global_rustc(Some(ws))?;
|
||||||
|
let rustc_version = rustc.version.clone().into();
|
||||||
|
rustc_version
|
||||||
|
};
|
||||||
|
version_prefs.max_rust_version(Some(rust_version));
|
||||||
}
|
}
|
||||||
|
|
||||||
let avoid_patch_ids = if register_patches {
|
let avoid_patch_ids = if register_patches {
|
||||||
|
|
|
@ -414,6 +414,7 @@ fn resolve_with_rustc() {
|
||||||
"\
|
"\
|
||||||
[UPDATING] `dummy-registry` index
|
[UPDATING] `dummy-registry` index
|
||||||
[LOCKING] 2 packages
|
[LOCKING] 2 packages
|
||||||
|
[ADDING] bar v1.5.0 (latest: v1.6.0)
|
||||||
",
|
",
|
||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
|
|
Loading…
Reference in New Issue