@@ -541,7 +541,7 @@ pub async fn main() -> Result<utils::ExitCode> {
541
541
info ! ( "This is the version for the rustup toolchain manager, not the rustc compiler." ) ;
542
542
543
543
#[ cfg_attr( feature = "otel" , tracing:: instrument) ]
544
- fn rustc_version ( ) -> std:: result:: Result < String , Box < dyn std:: error:: Error > > {
544
+ async fn rustc_version ( ) -> std:: result:: Result < String , Box < dyn std:: error:: Error > > {
545
545
let cfg = & mut common:: set_globals ( false , true ) ?;
546
546
let cwd = std:: env:: current_dir ( ) ?;
547
547
@@ -550,12 +550,12 @@ pub async fn main() -> Result<utils::ExitCode> {
550
550
cfg. set_toolchain_override ( & ResolvableToolchainName :: try_from ( & t[ 1 ..] ) ?) ;
551
551
}
552
552
553
- let toolchain = cfg. find_or_install_active_toolchain ( & cwd) ?. 0 ;
553
+ let toolchain = cfg. find_or_install_active_toolchain ( & cwd) . await ?. 0 ;
554
554
555
555
Ok ( toolchain. rustc_version ( ) )
556
556
}
557
557
558
- match rustc_version ( ) {
558
+ match rustc_version ( ) . await {
559
559
Ok ( version) => info ! ( "The currently active `rustc` version is `{}`" , version) ,
560
560
Err ( err) => debug ! ( "Wanted to tell you the current rustc version, too, but ran into this error: {}" , err) ,
561
561
}
@@ -640,7 +640,7 @@ pub async fn main() -> Result<utils::ExitCode> {
640
640
TargetSubcmd :: List {
641
641
toolchain,
642
642
installed,
643
- } => handle_epipe ( target_list ( cfg, toolchain, installed) ) ,
643
+ } => handle_epipe ( target_list ( cfg, toolchain, installed) . await ) ,
644
644
TargetSubcmd :: Add { target, toolchain } => target_add ( cfg, target, toolchain) . await ,
645
645
TargetSubcmd :: Remove { target, toolchain } => {
646
646
target_remove ( cfg, target, toolchain) . await
@@ -650,7 +650,7 @@ pub async fn main() -> Result<utils::ExitCode> {
650
650
ComponentSubcmd :: List {
651
651
toolchain,
652
652
installed,
653
- } => handle_epipe ( component_list ( cfg, toolchain, installed) ) ,
653
+ } => handle_epipe ( component_list ( cfg, toolchain, installed) . await ) ,
654
654
ComponentSubcmd :: Add {
655
655
component,
656
656
toolchain,
@@ -676,15 +676,15 @@ pub async fn main() -> Result<utils::ExitCode> {
676
676
command,
677
677
install,
678
678
} => run ( cfg, toolchain, command, install) . map ( ExitCode :: from) ,
679
- RustupSubcmd :: Which { command, toolchain } => which ( cfg, & command, toolchain) ,
679
+ RustupSubcmd :: Which { command, toolchain } => which ( cfg, & command, toolchain) . await ,
680
680
RustupSubcmd :: Doc {
681
681
path,
682
682
toolchain,
683
683
topic,
684
684
page,
685
- } => doc ( cfg, path, toolchain, topic. as_deref ( ) , & page) ,
685
+ } => doc ( cfg, path, toolchain, topic. as_deref ( ) , & page) . await ,
686
686
#[ cfg( not( windows) ) ]
687
- RustupSubcmd :: Man { command, toolchain } => man ( cfg, & command, toolchain) ,
687
+ RustupSubcmd :: Man { command, toolchain } => man ( cfg, & command, toolchain) . await ,
688
688
RustupSubcmd :: Self_ { subcmd } => match subcmd {
689
689
SelfSubcmd :: Update => self_update:: update ( cfg) . await ,
690
690
SelfSubcmd :: Uninstall { no_prompt } => self_update:: uninstall ( no_prompt) ,
@@ -904,7 +904,7 @@ fn run(
904
904
command:: run_command_for_dir ( cmd, & command[ 0 ] , & command[ 1 ..] )
905
905
}
906
906
907
- fn which (
907
+ async fn which (
908
908
cfg : & Cfg ,
909
909
binary : & str ,
910
910
toolchain : Option < ResolvableToolchainName > ,
@@ -913,7 +913,7 @@ fn which(
913
913
let desc = toolchain. resolve ( & cfg. get_default_host_triple ( ) ?) ?;
914
914
Toolchain :: new ( cfg, desc. into ( ) ) ?. binary_file ( binary)
915
915
} else {
916
- cfg. which_binary ( & utils:: current_dir ( ) ?, binary) ?
916
+ cfg. which_binary ( & utils:: current_dir ( ) ?, binary) . await ?
917
917
} ;
918
918
919
919
utils:: assert_is_file ( & binary_path) ?;
@@ -1091,13 +1091,13 @@ fn show_rustup_home(cfg: &Cfg) -> Result<utils::ExitCode> {
1091
1091
Ok ( utils:: ExitCode ( 0 ) )
1092
1092
}
1093
1093
1094
- fn target_list (
1094
+ async fn target_list (
1095
1095
cfg : & Cfg ,
1096
1096
toolchain : Option < PartialToolchainDesc > ,
1097
1097
installed_only : bool ,
1098
1098
) -> Result < utils:: ExitCode > {
1099
1099
// downcasting required because the toolchain files can name any toolchain
1100
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1100
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1101
1101
common:: list_items (
1102
1102
distributable,
1103
1103
|c| {
@@ -1122,7 +1122,7 @@ async fn target_add(
1122
1122
// isn't a feature yet.
1123
1123
// list_components *and* add_component would both be inappropriate for
1124
1124
// custom toolchains.
1125
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1125
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1126
1126
let components = distributable. components ( ) ?;
1127
1127
1128
1128
if targets. contains ( & "all" . to_string ( ) ) {
@@ -1166,7 +1166,7 @@ async fn target_remove(
1166
1166
targets : Vec < String > ,
1167
1167
toolchain : Option < PartialToolchainDesc > ,
1168
1168
) -> Result < utils:: ExitCode > {
1169
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1169
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1170
1170
1171
1171
for target in targets {
1172
1172
let target = TargetTriple :: new ( target) ;
@@ -1195,13 +1195,13 @@ async fn target_remove(
1195
1195
Ok ( utils:: ExitCode ( 0 ) )
1196
1196
}
1197
1197
1198
- fn component_list (
1198
+ async fn component_list (
1199
1199
cfg : & Cfg ,
1200
1200
toolchain : Option < PartialToolchainDesc > ,
1201
1201
installed_only : bool ,
1202
1202
) -> Result < utils:: ExitCode > {
1203
1203
// downcasting required because the toolchain files can name any toolchain
1204
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1204
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1205
1205
common:: list_items ( distributable, |c| Some ( & c. name ) , installed_only) ?;
1206
1206
Ok ( utils:: ExitCode ( 0 ) )
1207
1207
}
@@ -1212,7 +1212,7 @@ async fn component_add(
1212
1212
toolchain : Option < PartialToolchainDesc > ,
1213
1213
target : Option < String > ,
1214
1214
) -> Result < utils:: ExitCode > {
1215
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1215
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1216
1216
let target = get_target ( target, & distributable) ;
1217
1217
1218
1218
for component in & components {
@@ -1238,7 +1238,7 @@ async fn component_remove(
1238
1238
toolchain : Option < PartialToolchainDesc > ,
1239
1239
target : Option < String > ,
1240
1240
) -> Result < utils:: ExitCode > {
1241
- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) ?;
1241
+ let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1242
1242
let target = get_target ( target, & distributable) ;
1243
1243
1244
1244
for component in & components {
@@ -1418,14 +1418,14 @@ docs_data![
1418
1418
( embedded_book, "The Embedded Rust Book" , "embedded-book/index.html" ) ,
1419
1419
] ;
1420
1420
1421
- fn doc (
1421
+ async fn doc (
1422
1422
cfg : & Cfg ,
1423
1423
path_only : bool ,
1424
1424
toolchain : Option < PartialToolchainDesc > ,
1425
1425
mut topic : Option < & str > ,
1426
1426
doc_page : & DocPage ,
1427
1427
) -> Result < utils:: ExitCode > {
1428
- let toolchain = Toolchain :: from_partial ( toolchain, cfg) ?;
1428
+ let toolchain = Toolchain :: from_partial ( toolchain, cfg) . await ?;
1429
1429
1430
1430
if let Ok ( distributable) = DistributableToolchain :: try_from ( & toolchain) {
1431
1431
if let [ _] = distributable
@@ -1481,14 +1481,14 @@ fn doc(
1481
1481
}
1482
1482
1483
1483
#[ cfg( not( windows) ) ]
1484
- fn man (
1484
+ async fn man (
1485
1485
cfg : & Cfg ,
1486
1486
command : & str ,
1487
1487
toolchain : Option < PartialToolchainDesc > ,
1488
1488
) -> Result < utils:: ExitCode > {
1489
1489
use crate :: currentprocess:: varsource:: VarSource ;
1490
1490
1491
- let toolchain = Toolchain :: from_partial ( toolchain, cfg) ?;
1491
+ let toolchain = Toolchain :: from_partial ( toolchain, cfg) . await ?;
1492
1492
let mut path = toolchain. path ( ) . to_path_buf ( ) ;
1493
1493
path. push ( "share" ) ;
1494
1494
path. push ( "man" ) ;
0 commit comments