Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show deprecation warning without OS #2854

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ use super::{
self_update::{check_rustup_update, SelfUpdateMode},
};
use crate::cli::errors::CLIError;
use crate::dist::dist::{
PartialTargetTriple, PartialToolchainDesc, Profile, TargetTriple, ToolchainDesc,
};
use crate::dist::dist::{PartialTargetTriple, PartialToolchainDesc, Profile, TargetTriple};
use crate::dist::manifest::Component;
use crate::errors::RustupError;
use crate::process;
Expand Down Expand Up @@ -959,8 +957,8 @@ fn update(cfg: &mut Cfg, m: &ArgMatches<'_>) -> Result<utils::ExitCode> {

if toolchain_has_triple {
let host_arch = TargetTriple::from_host_or_build();
if let Ok(toolchain_desc) = ToolchainDesc::from_str(name) {
let target_triple = toolchain_desc.target;
if let Ok(partial_toolchain_desc) = PartialToolchainDesc::from_str(name) {
let target_triple = partial_toolchain_desc.resolve(&host_arch)?.target;
if !forced && !host_arch.can_run(&target_triple)? {
err!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain as the default.");
warn!(
Expand Down
25 changes: 25 additions & 0 deletions tests/cli-rustup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2147,6 +2147,31 @@ warning: If you meant to build software to target that platform, perhaps try `ru
});
}

#[test]
fn dont_warn_on_partial_build() {
setup(&|config| {
let triple = this_host_triple();
let arch = triple.split('-').next().unwrap();
let mut cmd = clitools::cmd(
config,
"rustup",
&["toolchain", "install", &format!("nightly-{}", arch)],
);
clitools::env(config, &mut cmd);
let out = cmd.output().unwrap();
assert!(out.status.success());
let stderr = String::from_utf8(out.stderr).unwrap();
assert!(stderr.contains(&format!(
r"info: syncing channel updates for 'nightly-{0}'",
triple
)));
assert!(!stderr.contains(&format!(
r"warning: toolchain 'nightly-{0}' may not be able to run on this system.",
arch
)));
})
}

/// Checks that `rust-toolchain.toml` files are considered
#[test]
fn rust_toolchain_toml() {
Expand Down