Rollup merge of #126572 - onur-ozkan:channel-problem, r=clubby789
override user defined channel when using precompiled rustc We need to override `rust.channel` if it's manually specified when using the CI rustc. This is because if the compiler uses a different channel than the one specified in config.toml, tests may fail due to using a different channel than the one used by the compiler during tests. For more context, see https://github.com/rust-lang/rust/pull/122709#issuecomment-2165246281.
This commit is contained in:
commit
cbf9d57e89
@ -1031,23 +1031,12 @@ pub fn default_doc(&self, paths: &[PathBuf]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn doc_rust_lang_org_channel(&self) -> String {
|
pub fn doc_rust_lang_org_channel(&self) -> String {
|
||||||
// When using precompiled compiler from CI, we need to use CI rustc's channel and
|
let channel = match &*self.config.channel {
|
||||||
// ignore `rust.channel` from the configuration. Otherwise most of the rustdoc tests
|
|
||||||
// will fail due to incompatible `DOC_RUST_LANG_ORG_CHANNEL`.
|
|
||||||
let channel = if let Some(commit) = self.config.download_rustc_commit() {
|
|
||||||
self.config
|
|
||||||
.read_file_by_commit(&PathBuf::from("src/ci/channel"), commit)
|
|
||||||
.trim()
|
|
||||||
.to_owned()
|
|
||||||
} else {
|
|
||||||
match &*self.config.channel {
|
|
||||||
"stable" => &self.version,
|
"stable" => &self.version,
|
||||||
"beta" => "beta",
|
"beta" => "beta",
|
||||||
"nightly" | "dev" => "nightly",
|
"nightly" | "dev" => "nightly",
|
||||||
// custom build of rustdoc maybe? link to the latest stable docs just in case
|
// custom build of rustdoc maybe? link to the latest stable docs just in case
|
||||||
_ => "stable",
|
_ => "stable",
|
||||||
}
|
|
||||||
.to_owned()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
format!("https://doc.rust-lang.org/{channel}")
|
format!("https://doc.rust-lang.org/{channel}")
|
||||||
|
@ -1718,7 +1718,23 @@ fn get_table(option: &str) -> Result<TomlConfig, toml::de::Error> {
|
|||||||
config.omit_git_hash = omit_git_hash.unwrap_or(default);
|
config.omit_git_hash = omit_git_hash.unwrap_or(default);
|
||||||
config.rust_info = GitInfo::new(config.omit_git_hash, &config.src);
|
config.rust_info = GitInfo::new(config.omit_git_hash, &config.src);
|
||||||
|
|
||||||
if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
|
// We need to override `rust.channel` if it's manually specified when using the CI rustc.
|
||||||
|
// This is because if the compiler uses a different channel than the one specified in config.toml,
|
||||||
|
// tests may fail due to using a different channel than the one used by the compiler during tests.
|
||||||
|
if let Some(commit) = &config.download_rustc_commit {
|
||||||
|
if is_user_configured_rust_channel {
|
||||||
|
println!(
|
||||||
|
"WARNING: `rust.download-rustc` is enabled. The `rust.channel` option will be overridden by the CI rustc's channel."
|
||||||
|
);
|
||||||
|
|
||||||
|
let channel = config
|
||||||
|
.read_file_by_commit(&PathBuf::from("src/ci/channel"), commit)
|
||||||
|
.trim()
|
||||||
|
.to_owned();
|
||||||
|
|
||||||
|
config.channel = channel;
|
||||||
|
}
|
||||||
|
} else if config.rust_info.is_from_tarball() && !is_user_configured_rust_channel {
|
||||||
ci_channel.clone_into(&mut config.channel);
|
ci_channel.clone_into(&mut config.channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user