Merge #9381
9381: Fix compilation on WASM r=matklad a=flodiebold Fixes #9214. Fixes #9210. Co-authored-by: Florian Diebold <flodiebold@gmail.com>
This commit is contained in:
commit
38da41ea6e
8
.github/workflows/ci.yaml
vendored
8
.github/workflows/ci.yaml
vendored
@ -66,6 +66,9 @@ jobs:
|
||||
|
||||
env:
|
||||
targets: "powerpc-unknown-linux-gnu x86_64-unknown-linux-musl"
|
||||
# The rust-analyzer binary is not expected to compile on WASM, but the IDE
|
||||
# crate should
|
||||
targets_ide: "wasm32-unknown-unknown"
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@ -79,7 +82,7 @@ jobs:
|
||||
override: true
|
||||
|
||||
- name: Install Rust targets
|
||||
run: rustup target add ${{ env.targets }}
|
||||
run: rustup target add ${{ env.targets }} ${{ env.targets_ide }}
|
||||
|
||||
- name: Cache Dependencies
|
||||
uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72
|
||||
@ -89,6 +92,9 @@ jobs:
|
||||
for target in ${{ env.targets }}; do
|
||||
cargo check --target=$target --all-targets
|
||||
done
|
||||
for target in ${{ env.targets_ide }}; do
|
||||
cargo check -p ide --target=$target --all-targets
|
||||
done
|
||||
|
||||
typescript:
|
||||
name: TypeScript
|
||||
|
@ -110,7 +110,7 @@ fn drop(&mut self) {
|
||||
D(Some(f))
|
||||
}
|
||||
|
||||
#[repr(transparent)]
|
||||
#[cfg_attr(not(target_arch = "wasm32"), repr(transparent))]
|
||||
pub struct JodChild(pub std::process::Child);
|
||||
|
||||
impl ops::Deref for JodChild {
|
||||
@ -135,7 +135,10 @@ fn drop(&mut self) {
|
||||
|
||||
impl JodChild {
|
||||
pub fn into_inner(self) -> std::process::Child {
|
||||
// SAFETY: repr transparent
|
||||
if cfg!(target_arch = "wasm32") {
|
||||
panic!("no processes on wasm");
|
||||
}
|
||||
// SAFETY: repr transparent, except on WASM
|
||||
unsafe { std::mem::transmute::<JodChild, std::process::Child>(self) }
|
||||
}
|
||||
}
|
||||
|
@ -236,3 +236,19 @@ unsafe fn slice_to_end(v: &mut Vec<u8>) -> &mut [u8] {
|
||||
slice::from_raw_parts_mut(v.as_mut_ptr().add(v.len()), v.capacity() - v.len())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
mod imp {
|
||||
use std::{
|
||||
io,
|
||||
process::{ChildStderr, ChildStdout},
|
||||
};
|
||||
|
||||
pub(crate) fn read2(
|
||||
_out_pipe: ChildStdout,
|
||||
_err_pipe: ChildStderr,
|
||||
_data: &mut dyn FnMut(bool, &mut Vec<u8>, bool),
|
||||
) -> io::Result<()> {
|
||||
panic!("no processes on wasm")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user