about summary refs log tree commit diff
path: root/src/librustc_errors
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-09-14 14:50:10 +0800
committerGitHub <noreply@github.com>2018-09-14 14:50:10 +0800
commit33bc6c3daeace99b65d0bd5bd0a4ef2592bd6e07 (patch)
tree700c0ea80d1f281e9fedc0c953a9670a2ff1b023 /src/librustc_errors
parentb3303edba67981ed087fc89c4302985d022589d0 (diff)
parent0c89243fd33a7f9f0ef4ddc9796047c646e9a688 (diff)
downloadrust-33bc6c3daeace99b65d0bd5bd0a4ef2592bd6e07.tar.gz
rust-33bc6c3daeace99b65d0bd5bd0a4ef2592bd6e07.zip
Rollup merge of #54024 - alexcrichton:compile-to-wasm, r=petrochenkov
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!
Diffstat (limited to 'src/librustc_errors')
-rw-r--r--src/librustc_errors/lock.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_errors/lock.rs b/src/librustc_errors/lock.rs
index e5baf93b000..ff323073c62 100644
--- a/src/librustc_errors/lock.rs
+++ b/src/librustc_errors/lock.rs
@@ -109,7 +109,7 @@ pub fn acquire_global_lock(name: &str) -> Box<dyn Any> {
     }
 }
 
-#[cfg(unix)]
+#[cfg(not(windows))]
 pub fn acquire_global_lock(_name: &str) -> Box<dyn Any> {
     Box::new(())
 }