@@ -1036,9 +1036,12 @@ async fn which(
10361036 binary : & str ,
10371037 toolchain : Option < ResolvableToolchainName > ,
10381038) -> Result < ExitCode > {
1039- let toolchain = cfg
1039+ let ( toolchain, _ ) = cfg
10401040 . local_toolchain ( match toolchain {
1041- Some ( name) => Some ( name. resolve ( & cfg. get_default_host_triple ( ) ?) ?. into ( ) ) ,
1041+ Some ( name) => Some ( (
1042+ name. resolve ( & cfg. get_default_host_triple ( ) ?) ?. into ( ) ,
1043+ ActiveSource :: CommandLine , // From --toolchain option
1044+ ) ) ,
10421045 None => None ,
10431046 } )
10441047 . await ?;
@@ -1251,6 +1254,8 @@ async fn target_list(
12511254 installed_only : bool ,
12521255 quiet : bool ,
12531256) -> Result < ExitCode > {
1257+ let toolchain = toolchain. map ( |desc| ( desc, ActiveSource :: CommandLine ) ) ;
1258+
12541259 // If a toolchain is Distributable, we can assume it has a manifest and thus print all possible targets and the installed ones.
12551260 // However, if it is a custom toolchain, we can only print the installed targets.
12561261 // NB: this decision is made based on the absence of a manifest in custom toolchains.
@@ -1268,7 +1273,7 @@ async fn target_list(
12681273 cfg. process ,
12691274 )
12701275 } else {
1271- let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?;
1276+ let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?. 0 ;
12721277 common:: list_items (
12731278 toolchain. installed_targets ( ) ?. iter ( ) . map ( |s| ( s, true ) ) ,
12741279 installed_only,
@@ -1288,9 +1293,13 @@ async fn target_add(
12881293 // isn't a feature yet.
12891294 // list_components *and* add_component would both be inappropriate for
12901295 // custom toolchains.
1291- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1292- let components = distributable. components ( ) ?;
1296+ let distributable = DistributableToolchain :: from_partial (
1297+ toolchain. map ( |desc| ( desc, ActiveSource :: CommandLine ) ) ,
1298+ cfg,
1299+ )
1300+ . await ?;
12931301
1302+ let components = distributable. components ( ) ?;
12941303 if targets. contains ( & "all" . to_string ( ) ) {
12951304 if targets. len ( ) != 1 {
12961305 return Err ( anyhow ! (
@@ -1332,7 +1341,11 @@ async fn target_remove(
13321341 targets : Vec < String > ,
13331342 toolchain : Option < PartialToolchainDesc > ,
13341343) -> Result < ExitCode > {
1335- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1344+ let distributable = DistributableToolchain :: from_partial (
1345+ toolchain. map ( |desc| ( desc, ActiveSource :: CommandLine ) ) ,
1346+ cfg,
1347+ )
1348+ . await ?;
13361349
13371350 for target in targets {
13381351 let target = TargetTriple :: new ( target) ;
@@ -1369,6 +1382,8 @@ async fn component_list(
13691382 installed_only : bool ,
13701383 quiet : bool ,
13711384) -> Result < ExitCode > {
1385+ let toolchain = toolchain. map ( |desc| ( desc, ActiveSource :: CommandLine ) ) ;
1386+
13721387 // downcasting required because the toolchain files can name any toolchain
13731388 if let Ok ( distributable) = DistributableToolchain :: from_partial ( toolchain. clone ( ) , cfg) . await {
13741389 common:: list_items (
@@ -1381,7 +1396,7 @@ async fn component_list(
13811396 cfg. process ,
13821397 )
13831398 } else {
1384- let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?;
1399+ let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?. 0 ;
13851400 common:: list_items (
13861401 toolchain
13871402 . installed_components ( ) ?
@@ -1400,9 +1415,13 @@ async fn component_add(
14001415 toolchain : Option < PartialToolchainDesc > ,
14011416 target : Option < String > ,
14021417) -> Result < ExitCode > {
1403- let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
1404- let target = get_target ( target, & distributable) ;
1418+ let distributable = DistributableToolchain :: from_partial (
1419+ toolchain. map ( |desc| ( desc, ActiveSource :: CommandLine ) ) ,
1420+ cfg,
1421+ )
1422+ . await ?;
14051423
1424+ let target = get_target ( target, & distributable) ;
14061425 for component in & components {
14071426 let new_component = Component :: try_new ( component, & distributable, target. as_ref ( ) ) ?;
14081427 distributable. add_component ( new_component) . await ?;
@@ -1426,6 +1445,7 @@ async fn component_remove(
14261445 toolchain : Option < PartialToolchainDesc > ,
14271446 target : Option < String > ,
14281447) -> Result < ExitCode > {
1448+ let toolchain = toolchain. map ( |desc| ( desc, ActiveSource :: CommandLine ) ) ;
14291449 let distributable = DistributableToolchain :: from_partial ( toolchain, cfg) . await ?;
14301450 let target = get_target ( target, & distributable) ;
14311451
@@ -1707,7 +1727,8 @@ async fn doc(
17071727 mut topic : Option < & str > ,
17081728 doc_page : & DocPage ,
17091729) -> Result < ExitCode > {
1710- let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?;
1730+ let toolchain = toolchain. map ( |desc| ( desc, ActiveSource :: CommandLine ) ) ;
1731+ let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?. 0 ;
17111732
17121733 if let Ok ( distributable) = DistributableToolchain :: try_from ( & toolchain)
17131734 && let [ _] = distributable
@@ -1772,7 +1793,8 @@ async fn man(
17721793 command : & str ,
17731794 toolchain : Option < PartialToolchainDesc > ,
17741795) -> Result < ExitCode > {
1775- let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?;
1796+ let toolchain = toolchain. map ( |desc| ( desc, ActiveSource :: CommandLine ) ) ;
1797+ let toolchain = cfg. toolchain_from_partial ( toolchain) . await ?. 0 ;
17761798 let path = toolchain. man_path ( ) ;
17771799 utils:: assert_is_directory ( & path) ?;
17781800
0 commit comments