Skip to content

Commit 3b99e48

Browse files
authored
Merge pull request #2854 from pjsier/deprecation-warning-stable-x86
Don't show deprecation warning without OS
2 parents 7c56bab + f3b444b commit 3b99e48

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

src/cli/rustup_mode.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ use super::{
1717
self_update::{check_rustup_update, SelfUpdateMode},
1818
};
1919
use crate::cli::errors::CLIError;
20-
use crate::dist::dist::{
21-
PartialTargetTriple, PartialToolchainDesc, Profile, TargetTriple, ToolchainDesc,
22-
};
20+
use crate::dist::dist::{PartialTargetTriple, PartialToolchainDesc, Profile, TargetTriple};
2321
use crate::dist::manifest::Component;
2422
use crate::errors::RustupError;
2523
use crate::process;
@@ -959,8 +957,8 @@ fn update(cfg: &mut Cfg, m: &ArgMatches<'_>) -> Result<utils::ExitCode> {
959957

960958
if toolchain_has_triple {
961959
let host_arch = TargetTriple::from_host_or_build();
962-
if let Ok(toolchain_desc) = ToolchainDesc::from_str(name) {
963-
let target_triple = toolchain_desc.target;
960+
if let Ok(partial_toolchain_desc) = PartialToolchainDesc::from_str(name) {
961+
let target_triple = partial_toolchain_desc.resolve(&host_arch)?.target;
964962
if !forced && !host_arch.can_run(&target_triple)? {
965963
err!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain as the default.");
966964
warn!(

tests/cli-rustup.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,6 +2147,31 @@ warning: If you meant to build software to target that platform, perhaps try `ru
21472147
});
21482148
}
21492149

2150+
#[test]
2151+
fn dont_warn_on_partial_build() {
2152+
setup(&|config| {
2153+
let triple = this_host_triple();
2154+
let arch = triple.split('-').next().unwrap();
2155+
let mut cmd = clitools::cmd(
2156+
config,
2157+
"rustup",
2158+
&["toolchain", "install", &format!("nightly-{}", arch)],
2159+
);
2160+
clitools::env(config, &mut cmd);
2161+
let out = cmd.output().unwrap();
2162+
assert!(out.status.success());
2163+
let stderr = String::from_utf8(out.stderr).unwrap();
2164+
assert!(stderr.contains(&format!(
2165+
r"info: syncing channel updates for 'nightly-{0}'",
2166+
triple
2167+
)));
2168+
assert!(!stderr.contains(&format!(
2169+
r"warning: toolchain 'nightly-{0}' may not be able to run on this system.",
2170+
arch
2171+
)));
2172+
})
2173+
}
2174+
21502175
/// Checks that `rust-toolchain.toml` files are considered
21512176
#[test]
21522177
fn rust_toolchain_toml() {

0 commit comments

Comments
 (0)