aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yaml8
-rw-r--r--crates/stdx/src/lib.rs7
-rw-r--r--crates/stdx/src/process.rs16
3 files changed, 28 insertions, 3 deletions
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 63518e67f..222676d5e 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -66,6 +66,9 @@ jobs:
66 66
67 env: 67 env:
68 targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl" 68 targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
69 # The rust-analyzer binary is not expected to compile on WASM, but the IDE
70 # crate should
71 targets_ide: "wasm32-unknown-unknown"
69 72
70 steps: 73 steps:
71 - name: Checkout repository 74 - name: Checkout repository
@@ -79,7 +82,7 @@ jobs:
79 override: true 82 override: true
80 83
81 - name: Install Rust targets 84 - name: Install Rust targets
82 run: rustup target add ${{ env.targets }} 85 run: rustup target add ${{ env.targets }} ${{ env.targets_ide }}
83 86
84 - name: Cache Dependencies 87 - name: Cache Dependencies
85 uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72 88 uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
@@ -89,6 +92,9 @@ jobs:
89 for target in ${{ env.targets }}; do 92 for target in ${{ env.targets }}; do
90 cargo check --target=$target --all-targets 93 cargo check --target=$target --all-targets
91 done 94 done
95 for target in ${{ env.targets_ide }}; do
96 cargo check -p ide --target=$target --all-targets
97 done
92 98
93 typescript: 99 typescript:
94 name: TypeScript 100 name: TypeScript
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs
index 18d5fadb9..2963484fa 100644
--- a/crates/stdx/src/lib.rs
+++ b/crates/stdx/src/lib.rs
@@ -110,7 +110,7 @@ pub fn defer<F: FnOnce()>(f: F) -> impl Drop {
110 D(Some(f)) 110 D(Some(f))
111} 111}
112 112
113#[repr(transparent)] 113#[cfg_attr(not(target_arch = "wasm32"), repr(transparent))]
114pub struct JodChild(pub std::process::Child); 114pub struct JodChild(pub std::process::Child);
115 115
116impl ops::Deref for JodChild { 116impl ops::Deref for JodChild {
@@ -135,7 +135,10 @@ impl Drop for JodChild {
135 135
136impl JodChild { 136impl JodChild {
137 pub fn into_inner(self) -> std::process::Child { 137 pub fn into_inner(self) -> std::process::Child {
138 // SAFETY: repr transparent 138 if cfg!(target_arch = "wasm32") {
139 panic!("no processes on wasm");
140 }
141 // SAFETY: repr transparent, except on WASM
139 unsafe { std::mem::transmute::<JodChild, std::process::Child>(self) } 142 unsafe { std::mem::transmute::<JodChild, std::process::Child>(self) }
140 } 143 }
141} 144}
diff --git a/crates/stdx/src/process.rs b/crates/stdx/src/process.rs
index 692a2ab3d..b290ba2f0 100644
--- a/crates/stdx/src/process.rs
+++ b/crates/stdx/src/process.rs
@@ -236,3 +236,19 @@ mod imp {
236 slice::from_raw_parts_mut(v.as_mut_ptr().add(v.len()), v.capacity() - v.len()) 236 slice::from_raw_parts_mut(v.as_mut_ptr().add(v.len()), v.capacity() - v.len())
237 } 237 }
238} 238}
239
240#[cfg(target_arch = "wasm32")]
241mod imp {
242 use std::{
243 io,
244 process::{ChildStderr, ChildStdout},
245 };
246
247 pub(crate) fn read2(
248 _out_pipe: ChildStdout,
249 _err_pipe: ChildStderr,
250 _data: &mut dyn FnMut(bool, &mut Vec<u8>, bool),
251 ) -> io::Result<()> {
252 panic!("no processes on wasm")
253 }
254}