@@ -540,25 +540,8 @@ pub async fn main(current_dir: PathBuf, process: &Process) -> Result<utils::Exit
540
540
Err ( err) if err. kind ( ) == DisplayVersion => {
541
541
write ! ( process. stdout( ) . lock( ) , "{err}" ) ?;
542
542
info ! ( "This is the version for the rustup toolchain manager, not the rustc compiler." ) ;
543
-
544
- #[ cfg_attr( feature = "otel" , tracing:: instrument) ]
545
- async fn rustc_version (
546
- current_dir : PathBuf ,
547
- process : & Process ,
548
- ) -> std:: result:: Result < String , Box < dyn std:: error:: Error > > {
549
- let cfg = & mut common:: set_globals ( current_dir, false , true , process) ?;
550
-
551
- if let Some ( t) = process. args ( ) . find ( |x| x. starts_with ( '+' ) ) {
552
- trace ! ( "Fetching rustc version from toolchain `{}`" , t) ;
553
- cfg. set_toolchain_override ( & ResolvableToolchainName :: try_from ( & t[ 1 ..] ) ?) ;
554
- }
555
-
556
- let toolchain = cfg. find_or_install_active_toolchain ( ) . await ?. 0 ;
557
-
558
- Ok ( toolchain. rustc_version ( ) )
559
- }
560
-
561
- match rustc_version ( current_dir, process) . await {
543
+ let mut cfg = common:: set_globals ( current_dir, false , true , process) ?;
544
+ match cfg. active_rustc_version ( ) . await {
562
545
Ok ( version) => info ! ( "The currently active `rustc` version is `{}`" , version) ,
563
546
Err ( err) => trace ! ( "Wanted to tell you the current rustc version, too, but ran into this error: {}" , err) ,
564
547
}
@@ -583,6 +566,7 @@ pub async fn main(current_dir: PathBuf, process: &Process) -> Result<utils::Exit
583
566
Err ( err)
584
567
}
585
568
} ?;
569
+
586
570
let cfg = & mut common:: set_globals ( current_dir, matches. verbose , matches. quiet , process) ?;
587
571
588
572
if let Some ( t) = & matches. plus_toolchain {
0 commit comments