about summary refs log tree commit diff
path: root/tvix/eval/src/systems.rs
diff options
context:
space:
mode:
authorAdam Joseph <adam@westernsemico.com>2022-10-27T22·06-0700
committerclbot <clbot@tvl.fyi>2022-10-27T23·23+0000
commit2502c0abefdf4c9ff0f2158cdd9d5e3f94d12ce6 (patch)
treeebe919f9c8cbbe991cb1696afb8eda14429b5202 /tvix/eval/src/systems.rs
parent4d83fd84b452b3c3245f3098c4eefe62b8e163e4 (diff)
fix(tvix/eval): correct wasm32-unknown-unknown to wasm32-none r/5215
Rustc uses wasm32-unknown-unknown, which is rejected by config.sub,
for wasm-in-the-browser environments.  Rustc should be using
wasm32-unknown-none, which config.sub accepts.  Hopefully the rustc
people will change their triple before stabilising this triple.  In
the meantime, we fix it here in order to unbreak tvixbolt.

https://doc.rust-lang.org/beta/nightly-rustc/rustc_target/spec/wasm32_unknown_unknown/index.html

Signed-off-by: Adam Joseph <adam@westernsemico.com>
Change-Id: I941fd8d6f3db4e249901772fd79321ad88cd9cc6
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7107
Reviewed-by: tazjin <tazjin@tvl.su>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
Diffstat (limited to '')
-rw-r--r--tvix/eval/src/systems.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/tvix/eval/src/systems.rs b/tvix/eval/src/systems.rs
index e06bf57e78..cfdbe2eed5 100644
--- a/tvix/eval/src/systems.rs
+++ b/tvix/eval/src/systems.rs
@@ -25,6 +25,17 @@ pub fn llvm_triple_to_nix_double(llvm_triple: &str) -> String {
         [_vendor, kernel, _environment] if is_second_coordinate(kernel) => kernel,
         [_vendor, kernel] if is_second_coordinate(kernel) => kernel,
         [kernel, _environment] if is_second_coordinate(kernel) => kernel,
+
+        // Rustc uses wasm32-unknown-unknown, which is rejected by
+        // config.sub, for wasm-in-the-browser environments.  Rustc
+        // should be using wasm32-unknown-none, which config.sub
+        // accepts.  Hopefully the rustc people will change their
+        // triple before stabilising this triple.  In the meantime,
+        // we fix it here in order to unbreak tvixbolt.
+        //
+        // https://doc.rust-lang.org/beta/nightly-rustc/rustc_target/spec/wasm32_unknown_unknown/index.html
+        ["unknown", "unknown"] if cpu == "wasm32" => "none",
+
         _ => panic!("unrecognized triple {llvm_triple}"),
     };
     format!("{cpu}-{os}")