@@ -15,7 +15,9 @@ use super::self_update;
15
15
use super :: term2;
16
16
use super :: term2:: Terminal ;
17
17
use super :: topical_doc;
18
- use crate :: dist:: dist:: { PartialTargetTriple , PartialToolchainDesc , Profile , TargetTriple } ;
18
+ use crate :: dist:: dist:: {
19
+ PartialTargetTriple , PartialToolchainDesc , Profile , TargetTriple , ToolchainDesc ,
20
+ } ;
19
21
use crate :: dist:: manifest:: Component ;
20
22
use crate :: process;
21
23
use crate :: toolchain:: { CustomToolchain , DistributableToolchain } ;
@@ -904,6 +906,32 @@ fn update(cfg: &mut Cfg, m: &ArgMatches<'_>) -> Result<utils::ExitCode> {
904
906
if let Some ( names) = m. values_of ( "toolchain" ) {
905
907
for name in names {
906
908
update_bare_triple_check ( cfg, name) ?;
909
+
910
+ let toolchain_has_triple = match PartialToolchainDesc :: from_str ( name) {
911
+ Ok ( x) => x. has_triple ( ) ,
912
+ _ => false ,
913
+ } ;
914
+
915
+ if toolchain_has_triple {
916
+ let host_arch = TargetTriple :: from_host_or_build ( ) ;
917
+ match ToolchainDesc :: from_str ( name) {
918
+ Ok ( toolchain_desc) => {
919
+ let target_triple = toolchain_desc. target ;
920
+ if host_arch. ne ( & target_triple) {
921
+ warn ! (
922
+ "toolchain '{}' may not be able to run on this system." ,
923
+ name
924
+ ) ;
925
+ warn ! (
926
+ "If you meant to build software to target that platform, perhaps try `rustup target add {}` instead?" ,
927
+ target_triple. to_string( )
928
+ ) ;
929
+ }
930
+ }
931
+ _ => ( ) ,
932
+ }
933
+ }
934
+
907
935
let toolchain = cfg. get_toolchain ( name, false ) ?;
908
936
909
937
let status = if !toolchain. is_custom ( ) {
0 commit comments