about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-02-11 01:37:56 +0100
committerGitHub <noreply@github.com>2024-02-11 01:37:56 +0100
commit955cbdfdaf8e2f22742a63395e513174d57ede34 (patch)
tree69712ad0ed5a6b85d2d19cd16657907757ec4a1c
parent09bbcd6667631e31c63e9f8d1c930e2bab5ebeb3 (diff)
parentfd470e58c2282755bc6cbd5ef318577d2eb10322 (diff)
downloadrust-955cbdfdaf8e2f22742a63395e513174d57ede34.tar.gz
rust-955cbdfdaf8e2f22742a63395e513174d57ede34.zip
Rollup merge of #120890 - TimNN:relax-patches-check, r=onur-ozkan
Adapt `llvm-has-rust-patches` validation to take `llvm-config` into account.

This adapts an assertion that was added in #119556.

The current assertion does not take the `llvm-config` setting into accounts, which does not match the `llvm-has-rust-patches` documentation, which states:

> This would be used in conjunction with either an llvm-config or build.submodules = false.

(It also breaks my workflow: I build LLVM separately, but do have the rust patches applied).

---

**edit:** Originally this PR just removed the assertion, but it now implements the alternative mentioned here:

An alternative fix would be to take `llvm-config` into account in the assertion, but to me the assertion seems to provide little value, thus the simpler fix of just removing it.

cc `@onur-ozkan,` in case I'm missing a reason to keep the assertion.
-rw-r--r--src/bootstrap/src/core/config/config.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index c0dd1e12084..4c64850c0e0 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -1810,10 +1810,9 @@ impl Config {
                     target.llvm_config = Some(config.src.join(s));
                 }
                 if let Some(patches) = cfg.llvm_has_rust_patches {
-                    assert_eq!(
-                        config.submodules,
-                        Some(false),
-                        "cannot set `llvm-has-rust-patches` for a managed submodule (set `build.submodules = false` if you want to apply patches)"
+                    assert!(
+                        config.submodules == Some(false) || cfg.llvm_config.is_some(),
+                        "use of `llvm-has-rust-patches` is restricted to cases where either submodules are disabled or llvm-config been provided"
                     );
                     target.llvm_has_rust_patches = Some(patches);
                 }