Repository navigation
Conversation
|
We ran into the same problem building for wasm32-unknown-unknown with wgpu and winit; this fix works for us, and mlua's tests pass natively and on wasm32. Thanks! |
Author
Glad to hear it worked for you. I hope that this PR will be approved by the maintainer soon. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #742. Related: #23, #662.
HeapDump::newuses libc stdio (tmpfile,fseek,ftell,rewind,fread,fclose), which thelibccrate does not provide forwasm32-unknown-unknown, so theluaufeature does not compile for that target.This PR puts the stdio block behind
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]. On that target the dump buffer stays empty andHeapDump::newreturnsNone, soLua::heap_dump()returns the existing "unable to dump heap" error. Twoallowattributes silence the unused-code warnings on that target only.Every other target, including
wasm32-unknown-emscripten, compiles exactly the same code as before.Testing
cargo test --features "luau vendored": 310 passed, 0 failed, includingtest_heap_dump.cargo clippy --features "luau vendored" -- -D warningsandcargo fmt --all --check: clean.cargo build --lib --features "luau vendored" --target wasm32-unknown-unknown, with Luau's C++ built by clang against a wasi-sdk sysroot (LUAU_CXXFLAGS): fails onmainwith the 7 errors in luau feature fails to compile for wasm32-unknown-unknown (HeapDump uses libc stdio) #742, compiles with this change. Luau then runs in the browser underwasm-bindgen: eval, runtime and syntax errors,pcalland coroutines.This doesn't make
wasm32-unknown-unknownan officially supported target. It only removes the one Rust-side compile error, so projects that provide their own C++ toolchain can use it.