Rollup merge of #128098 - onur-ozkan:incompatible-option-behaviour, r=Kobzol
make it possible to disable download-rustc if it's incompatible Primarily needed by CI runners to avoid handling download-rustc incompatible options one by one on shell scripts. This will significantly help to #122709.
This commit is contained in:
commit
041b8c4447
1 changed files with 24 additions and 10 deletions
|
@ -1570,11 +1570,22 @@ impl Config {
|
||||||
let mut is_user_configured_rust_channel = false;
|
let mut is_user_configured_rust_channel = false;
|
||||||
|
|
||||||
if let Some(rust) = toml.rust {
|
if let Some(rust) = toml.rust {
|
||||||
config.download_rustc_commit =
|
if let Some(commit) = config.download_ci_rustc_commit(rust.download_rustc.clone()) {
|
||||||
config.download_ci_rustc_commit(rust.download_rustc.clone());
|
// Primarily used by CI runners to avoid handling download-rustc incompatible
|
||||||
|
// options one by one on shell scripts.
|
||||||
|
let disable_ci_rustc_if_incompatible =
|
||||||
|
env::var_os("DISABLE_CI_RUSTC_IF_INCOMPATIBLE")
|
||||||
|
.is_some_and(|s| s == "1" || s == "true");
|
||||||
|
|
||||||
if config.download_rustc_commit.is_some() {
|
if let Err(e) = check_incompatible_options_for_ci_rustc(&rust) {
|
||||||
check_incompatible_options_for_ci_rustc(&rust);
|
if disable_ci_rustc_if_incompatible {
|
||||||
|
config.download_rustc_commit = None;
|
||||||
|
} else {
|
||||||
|
panic!("{}", e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
config.download_rustc_commit = Some(commit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let Rust {
|
let Rust {
|
||||||
|
@ -2612,14 +2623,15 @@ impl Config {
|
||||||
|
|
||||||
/// Checks the CI rustc incompatible options by destructuring the `Rust` instance
|
/// Checks the CI rustc incompatible options by destructuring the `Rust` instance
|
||||||
/// and makes sure that no rust options from config.toml are missed.
|
/// and makes sure that no rust options from config.toml are missed.
|
||||||
fn check_incompatible_options_for_ci_rustc(rust: &Rust) {
|
fn check_incompatible_options_for_ci_rustc(rust: &Rust) -> Result<(), String> {
|
||||||
macro_rules! err {
|
macro_rules! err {
|
||||||
($name:expr) => {
|
($name:expr) => {
|
||||||
assert!(
|
if $name.is_some() {
|
||||||
$name.is_none(),
|
return Err(format!(
|
||||||
"ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`.",
|
"ERROR: Setting `rust.{}` is incompatible with `rust.download-rustc`.",
|
||||||
stringify!($name).replace("_", "-")
|
stringify!($name).replace("_", "-")
|
||||||
);
|
));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2715,6 +2727,8 @@ fn check_incompatible_options_for_ci_rustc(rust: &Rust) {
|
||||||
warn!(channel);
|
warn!(channel);
|
||||||
warn!(description);
|
warn!(description);
|
||||||
warn!(incremental);
|
warn!(incremental);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set<T>(field: &mut T, val: Option<T>) {
|
fn set<T>(field: &mut T, val: Option<T>) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue