@@ -1544,9 +1544,6 @@ impl Config {
15441544 }
15451545 }
15461546
1547- let file_content = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
1548- let ci_channel = file_content. trim_end ( ) ;
1549-
15501547 // Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
15511548 // but not if `bootstrap.toml` hasn't been created.
15521549 let mut toml = if !using_default_path || toml_path. exists ( ) {
@@ -1852,17 +1849,21 @@ impl Config {
18521849 let mut lld_enabled = None ;
18531850 let mut std_features = None ;
18541851
1855- let is_user_configured_rust_channel =
1856- if let Some ( channel ) = toml . rust . as_ref ( ) . and_then ( |r| r . channel . clone ( ) ) {
1857- if channel == "auto-detect" {
1858- config . channel = ci_channel . into ( ) ;
1859- } else {
1860- config . channel = channel ;
1861- }
1852+ let file_content = t ! ( fs :: read_to_string ( config . src . join ( "src/ci/channel" ) ) ) ;
1853+ let ci_channel = file_content . trim_end ( ) ;
1854+
1855+ let toml_channel = toml . rust . as_ref ( ) . and_then ( |r| r . channel . clone ( ) ) ;
1856+ let is_user_configured_rust_channel = match toml_channel {
1857+ Some ( channel ) if channel == "auto-detect" => {
1858+ config . channel = ci_channel . into ( ) ;
18621859 true
1863- } else {
1864- false
1865- } ;
1860+ }
1861+ Some ( channel) => {
1862+ config. channel = channel;
1863+ true
1864+ }
1865+ None => false ,
1866+ } ;
18661867
18671868 let default = config. channel == "dev" ;
18681869 config. omit_git_hash = toml. rust . as_ref ( ) . and_then ( |r| r. omit_git_hash ) . unwrap_or ( default) ;
@@ -1887,6 +1888,10 @@ impl Config {
18871888 && config. src . join ( ".cargo/config.toml" ) . exists ( ) ,
18881889 ) ;
18891890
1891+ if !is_user_configured_rust_channel && config. rust_info . is_from_tarball ( ) {
1892+ config. channel = ci_channel. into ( ) ;
1893+ }
1894+
18901895 if let Some ( rust) = toml. rust {
18911896 let Rust {
18921897 optimize : optimize_toml,
@@ -2090,8 +2095,6 @@ impl Config {
20902095
20912096 config. channel = channel;
20922097 }
2093- } else if config. rust_info . is_from_tarball ( ) && !is_user_configured_rust_channel {
2094- ci_channel. clone_into ( & mut config. channel ) ;
20952098 }
20962099
20972100 if let Some ( llvm) = toml. llvm {
0 commit comments