Skip to content

Commit

Permalink
fix(install): Don't respect MSRV for non-local installs
Browse files Browse the repository at this point in the history
This is part of rust-lang#9930
  • Loading branch information
epage committed Apr 23, 2024
1 parent 6e9f948 commit 7df4d88
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/cargo/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,10 @@ impl<'gctx> Workspace<'gctx> {
self.honor_rust_version
}

pub fn set_resolve_honors_rust_version(&mut self, honor_rust_version: Option<bool>) {
self.resolve_honors_rust_version = honor_rust_version;
}

pub fn resolve_honors_rust_version(&self) -> bool {
// Give CLI precedence
self.honor_rust_version
Expand Down
4 changes: 3 additions & 1 deletion src/cargo/ops/cargo_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,9 @@ fn make_ws_rustc_target<'gctx>(
let mut ws = if source_id.is_git() || source_id.is_path() {
Workspace::new(pkg.manifest_path(), gctx)?
} else {
Workspace::ephemeral(pkg, gctx, None, false)?
let mut ws = Workspace::ephemeral(pkg, gctx, None, false)?;
ws.set_resolve_honors_rust_version(Some(false));
ws
};
ws.set_ignore_lock(gctx.lock_update_allowed());
ws.set_require_optional_deps(false);
Expand Down
7 changes: 3 additions & 4 deletions tests/testsuite/rust_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,11 +1146,10 @@ fn cargo_install_ignores_msrv_config() {
[DOWNLOADING] crates ...
[DOWNLOADED] foo v0.0.1 (registry [..])
[INSTALLING] foo v0.0.1
[LOCKING] 2 packages to latest Rust 1.60 compatible versions
[ADDING] dep v1.0.0 (latest: v1.1.0)
[LOCKING] 2 packages to latest compatible versions
[DOWNLOADING] crates ...
[DOWNLOADED] dep v1.0.0 (registry [..])
[COMPILING] dep v1.0.0
[DOWNLOADED] dep v1.1.0 (registry [..])
[COMPILING] dep v1.1.0
[COMPILING] foo v0.0.1
[FINISHED] `release` profile [optimized] target(s) in [..]
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
Expand Down

0 comments on commit 7df4d88

Please sign in to comment.