-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compiling some rustc crates to wasm #54024
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
The diff here is best viewed ignoring whitespace |
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 |
I was dabbling recently seeing what it would take to compile `rustfmt` to the `wasm32-unknown-unknown` target and it turns out not much effort is needed! Currently `rustfmt` depends on a few rustc crates published to crates.io, so this commit touches up those crates to compile for wasm themselves. Notably: * The `rustc_data_structures` crate's `flock` implementation is stubbed out to unconditionally return errors on unsupported platforms. * The `rustc_errors` crate is extended to not do any locking for all non-windows platforms. In both of these cases if we port the compiler to new platforms the functionality isn't critical but will be discovered over time as it comes up, so this hopefully doesn't make it too too hard to compile to new platforms!
2a326d3
to
0c89243
Compare
@bors r+ |
📌 Commit 0c89243 has been approved by |
…rochenkov Fix compiling some rustc crates to wasm I was dabbling recently seeing what it would take to compile `rustfmt` to the `wasm32-unknown-unknown` target and it turns out not much effort is needed! Currently `rustfmt` depends on a few rustc crates published to crates.io, so this commit touches up those crates to compile for wasm themselves. Notably: * The `rustc_data_structures` crate's `flock` implementation is stubbed out to unconditionally return errors on unsupported platforms. * The `rustc_errors` crate is extended to not do any locking for all non-windows platforms. In both of these cases if we port the compiler to new platforms the functionality isn't critical but will be discovered over time as it comes up, so this hopefully doesn't make it too too hard to compile to new platforms!
…rochenkov Fix compiling some rustc crates to wasm I was dabbling recently seeing what it would take to compile `rustfmt` to the `wasm32-unknown-unknown` target and it turns out not much effort is needed! Currently `rustfmt` depends on a few rustc crates published to crates.io, so this commit touches up those crates to compile for wasm themselves. Notably: * The `rustc_data_structures` crate's `flock` implementation is stubbed out to unconditionally return errors on unsupported platforms. * The `rustc_errors` crate is extended to not do any locking for all non-windows platforms. In both of these cases if we port the compiler to new platforms the functionality isn't critical but will be discovered over time as it comes up, so this hopefully doesn't make it too too hard to compile to new platforms!
Rollup of 8 pull requests Successful merges: - #53218 (Add a implementation of `From` for converting `&'a Option<T>` into `Option<&'a T>`) - #54024 (Fix compiling some rustc crates to wasm) - #54095 (Rename all mentions of `nil` to `unit`) - #54173 (Suggest valid crate type if invalid crate type is found) - #54194 (Remove println!() statement from HashMap unit test) - #54203 (Fix the stable release of os_str_str_ref_eq) - #54207 (re-mark the never docs as unstable) - #54210 (Update Cargo) Failed merges: r? @ghost
I was dabbling recently seeing what it would take to compile
rustfmt
to thewasm32-unknown-unknown
target and it turns out not much effort is needed!Currently
rustfmt
depends on a few rustc crates published to crates.io, sothis commit touches up those crates to compile for wasm themselves. Notably:
rustc_data_structures
crate'sflock
implementation is stubbed out tounconditionally return errors on unsupported platforms.
rustc_errors
crate is extended to not do any locking for all non-windowsplatforms.
In both of these cases if we port the compiler to new platforms the
functionality isn't critical but will be discovered over time as it comes up, so
this hopefully doesn't make it too too hard to compile to new platforms!