File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -98,12 +98,16 @@ pub enum RustupError {
98
98
#[ error(
99
99
"toolchain '{name}' is not installed{}" ,
100
100
if let ToolchainName :: Official ( t) = name {
101
- format!( "\n help: run `rustup toolchain install {t}` to install it" )
101
+ let t = if * is_active { "" } else { & format!( " {t}" ) } ;
102
+ format!( "\n help: run `rustup toolchain install{t}` to install it" )
102
103
} else {
103
104
String :: new( )
104
105
} ,
105
106
) ]
106
- ToolchainNotInstalled { name : ToolchainName } ,
107
+ ToolchainNotInstalled {
108
+ name : ToolchainName ,
109
+ is_active : bool ,
110
+ } ,
107
111
#[ error( "path '{0}' not found" ) ]
108
112
PathToolchainNotInstalled ( PathBasedToolchainName ) ,
109
113
#[ error(
Original file line number Diff line number Diff line change @@ -107,7 +107,10 @@ impl<'a> Toolchain<'a> {
107
107
let path = cfg. toolchain_path ( & name) ;
108
108
if !Toolchain :: exists ( cfg, & name) ? {
109
109
return Err ( match name {
110
- LocalToolchainName :: Named ( name) => RustupError :: ToolchainNotInstalled { name } ,
110
+ LocalToolchainName :: Named ( name) => {
111
+ let is_active = matches ! ( cfg. active_toolchain( ) , Ok ( Some ( ( t, _) ) ) if t == name) ;
112
+ RustupError :: ToolchainNotInstalled { name, is_active }
113
+ }
111
114
LocalToolchainName :: Path ( name) => RustupError :: PathToolchainNotInstalled ( name) ,
112
115
} ) ;
113
116
}
You can’t perform that action at this time.
0 commit comments