@@ -1097,7 +1097,7 @@ pub(crate) async fn self_update(disabled: bool, cfg: &Cfg<'_>) -> Result<utils::
1097
1097
info ! ( "self-update is disabled for this build of rustup" ) ;
1098
1098
info ! ( "any updates to rustup will need to be fetched with your system package manager" )
1099
1099
} else if self_update_mode == SelfUpdateMode :: CheckOnly {
1100
- check_rustup_update ( cfg. process ) . await ?;
1100
+ check_rustup_update ( disabled , cfg) . await ?;
1101
1101
return Ok ( utils:: ExitCode ( 0 ) ) ;
1102
1102
} else if disabled {
1103
1103
info ! ( "self-update is disabled by command line argument" ) ;
@@ -1338,13 +1338,22 @@ impl fmt::Display for SchemaVersion {
1338
1338
}
1339
1339
1340
1340
/// Returns whether an update was available
1341
- pub ( crate ) async fn check_rustup_update ( process : & Process ) -> anyhow:: Result < bool > {
1342
- let mut t = process. stdout ( ) . terminal ( process) ;
1341
+ pub ( crate ) async fn check_rustup_update ( disabled : bool , cfg : & Cfg < ' _ > ) -> anyhow:: Result < bool > {
1342
+ // Priority: no-self-update feature > self_update_mode > no-self-update args.
1343
+ // Check for update only if rustup does **not** have the no-self-update feature,
1344
+ // and auto-self-update is configured to **enable**
1345
+ // and has **no** no-self-update parameter.
1346
+ let self_update_mode = SelfUpdateMode :: from_cfg ( cfg) ?;
1347
+ if cfg ! ( feature = "no-self-update" ) || self_update_mode == SelfUpdateMode :: Disable || disabled {
1348
+ return Ok ( false ) ;
1349
+ }
1350
+
1351
+ let mut t = cfg. process . stdout ( ) . terminal ( & cfg. process ) ;
1343
1352
// Get current rustup version
1344
1353
let current_version = env ! ( "CARGO_PKG_VERSION" ) ;
1345
1354
1346
1355
// Get available rustup version
1347
- let available_version = get_available_rustup_version ( process) . await ?;
1356
+ let available_version = get_available_rustup_version ( & cfg . process ) . await ?;
1348
1357
1349
1358
let _ = t. attr ( terminalsource:: Attr :: Bold ) ;
1350
1359
write ! ( t. lock( ) , "rustup - " ) ?;
0 commit comments