@@ -753,7 +753,8 @@ impl<'a> Cfg<'a> {
753
753
} => {
754
754
let toolchain = self
755
755
. ensure_installed ( toolchain, components, targets, profile)
756
- . await ?;
756
+ . await ?
757
+ . 1 ;
757
758
Ok ( ( toolchain, reason) )
758
759
}
759
760
} ,
@@ -768,7 +769,8 @@ impl<'a> Cfg<'a> {
768
769
let reason = ActiveReason :: Default ;
769
770
let toolchain = self
770
771
. ensure_installed ( toolchain_desc, vec ! [ ] , vec ! [ ] , None )
771
- . await ?;
772
+ . await ?
773
+ . 1 ;
772
774
Ok ( ( toolchain, reason) )
773
775
}
774
776
} ,
@@ -784,14 +786,14 @@ impl<'a> Cfg<'a> {
784
786
components : Vec < String > ,
785
787
targets : Vec < String > ,
786
788
profile : Option < Profile > ,
787
- ) -> Result < Toolchain < ' _ > > {
789
+ ) -> Result < ( UpdateStatus , Toolchain < ' _ > ) > {
788
790
let components: Vec < _ > = components. iter ( ) . map ( AsRef :: as_ref) . collect ( ) ;
789
791
let targets: Vec < _ > = targets. iter ( ) . map ( AsRef :: as_ref) . collect ( ) ;
790
792
let profile = match profile {
791
793
Some ( profile) => profile,
792
794
None => self . get_profile ( ) ?,
793
795
} ;
794
- let toolchain = match DistributableToolchain :: new ( self , toolchain. clone ( ) ) {
796
+ let ( status , toolchain) = match DistributableToolchain :: new ( self , toolchain. clone ( ) ) {
795
797
Err ( RustupError :: ToolchainNotInstalled ( _) ) => {
796
798
DistributableToolchain :: install (
797
799
self ,
@@ -802,18 +804,18 @@ impl<'a> Cfg<'a> {
802
804
false ,
803
805
)
804
806
. await ?
805
- . 1
806
807
}
807
808
Ok ( mut distributable) => {
808
- if !distributable. components_exist ( & components, & targets) ? {
809
- distributable. update ( & components, & targets, profile) . await ?;
810
- }
811
- distributable
809
+ let status = if !distributable. components_exist ( & components, & targets) ? {
810
+ distributable. update ( & components, & targets, profile) . await ?
811
+ } else {
812
+ UpdateStatus :: Unchanged
813
+ } ;
814
+ ( status, distributable)
812
815
}
813
816
Err ( e) => return Err ( e. into ( ) ) ,
814
- }
815
- . into ( ) ;
816
- Ok ( toolchain)
817
+ } ;
818
+ Ok ( ( status, toolchain. into ( ) ) )
817
819
}
818
820
819
821
/// Get the configured default toolchain.
0 commit comments