allow wasm32 compilation of librustc_data_structures/profiling.rs#71369
allow wasm32 compilation of librustc_data_structures/profiling.rs#71369bors merged 6 commits intorust-lang:masterfrom
Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @ecstatic-morse (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
|
The job Click to expand the log.I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
|
@ctaggart would you mind converting this to use the |
|
Thanks for the feedback! I switched it to use |
| if #[cfg(target_os = "wasi")] { | ||
| type SerializationSink = measureme::FileSerializationSink; | ||
| } else { | ||
| type SerializationSink = measureme::ByteVecSink; |
There was a problem hiding this comment.
Same here, ByteVecSinkFileSerializationSink is the fallback. MmapSerializationSink is used on the *NIX family. ByteVecSink gets used if #[cfg(all(target_arch = "wasm32", not(target_os = "wasi"))]
There was a problem hiding this comment.
I accepted the code suggestion. Code suggestions are probably easiest to resolve these remaining points. I'm fighting a fever and it is hard for me to think.
Co-Authored-By: bjorn3 <bjorn3@users.noreply.github.com>
Co-Authored-By: ecstatic-morse <ecstaticmorse@gmail.com>
|
📌 Commit 51b194f has been approved by |
|
Sure |
|
Thanks for exploring this issue @ctaggart, and let us know if you find any other bugs while targeting wasm. |
|
I tried compiling rustc to wasm using wasi about a year ago: https://github.com/bjorn3/rust/tree/compile_rustc_wasm3. Unfortunately at that time there was a trap somewhere while running an example in miri. I tried debugging it (see all the |
Rollup of 5 pull requests Successful merges: - rust-lang#71256 (Lint must_use on mem::replace) - rust-lang#71350 (Error code explanation extra check) - rust-lang#71369 (allow wasm32 compilation of librustc_data_structures/profiling.rs) - rust-lang#71400 (proc_macro::is_available()) - rust-lang#71440 (Implement `Copy` for `AllocErr`) Failed merges: r? @ghost
I'm trying to use rustfmt from a wasm app. I ran into this compilation problem rust-lang/rustfmt#4132 and after investigating, it looked like just adjusting a few cfg's. I based it on how measureme added support in rust-lang/measureme#43.
My testing on my macbook was just that librustc_data_structures builds now with both: