@@ -1540,9 +1540,6 @@ impl Config {
15401540 }
15411541 }
15421542
1543- let file_content = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
1544- let ci_channel = file_content. trim_end ( ) ;
1545-
15461543 // Give a hard error if `--config` or `RUST_BOOTSTRAP_CONFIG` are set to a missing path,
15471544 // but not if `bootstrap.toml` hasn't been created.
15481545 let mut toml = if !using_default_path || toml_path. exists ( ) {
@@ -1847,16 +1844,21 @@ impl Config {
18471844 let mut lld_enabled = None ;
18481845 let mut std_features = None ;
18491846
1847+ let file_content = t ! ( fs:: read_to_string( config. src. join( "src/ci/channel" ) ) ) ;
1848+ let ci_channel = file_content. trim_end ( ) ;
1849+
18501850 let is_user_configured_rust_channel =
1851- if let Some ( channel) = toml. rust . as_ref ( ) . and_then ( |r| r. channel . clone ( ) ) {
1852- if channel == "auto-detect" {
1853- config. channel = ci_channel. into ( ) ;
1854- } else {
1855- config. channel = channel;
1851+ match toml. rust . as_ref ( ) . and_then ( |r| r. channel . clone ( ) ) {
1852+ Some ( channel) => {
1853+ if channel == "auto-detect" {
1854+ config. channel = ci_channel. into ( ) ;
1855+ } else {
1856+ config. channel = channel;
1857+ }
1858+
1859+ true
18561860 }
1857- true
1858- } else {
1859- false
1861+ None => false ,
18601862 } ;
18611863
18621864 let default = config. channel == "dev" ;
@@ -1882,6 +1884,10 @@ impl Config {
18821884 && config. src . join ( ".cargo/config.toml" ) . exists ( ) ,
18831885 ) ;
18841886
1887+ if !is_user_configured_rust_channel && config. rust_info . is_from_tarball ( ) {
1888+ config. channel = ci_channel. into ( ) ;
1889+ }
1890+
18851891 if let Some ( rust) = toml. rust {
18861892 let Rust {
18871893 optimize : optimize_toml,
@@ -2085,8 +2091,6 @@ impl Config {
20852091
20862092 config. channel = channel;
20872093 }
2088- } else if config. rust_info . is_from_tarball ( ) && !is_user_configured_rust_channel {
2089- ci_channel. clone_into ( & mut config. channel ) ;
20902094 }
20912095
20922096 if let Some ( llvm) = toml. llvm {
0 commit comments