about summary refs log tree commit diff
path: root/src/libsyntax/tokenstream.rs
diff options
context:
space:
mode:
authorFelix S Klock II <pnkfelix@pnkfx.org>2019-06-14 12:19:26 +0200
committerGitHub <noreply@github.com>2019-06-14 12:19:26 +0200
commit0baa9258dd2f901a24d744705f514fa678e64940 (patch)
treef764c7df971a171d43324b58872fa36c0df1bf22 /src/libsyntax/tokenstream.rs
parentbb97fe0bae0d4dcfd106e77a951ea8dbb4be2659 (diff)
downloadrust-0baa9258dd2f901a24d744705f514fa678e64940.tar.gz
rust-0baa9258dd2f901a24d744705f514fa678e64940.zip
put back the workarounds for #60846
based on https://github.com/rust-lang/rust/pull/61754#issuecomment-501743750 I am adding `bootstrap` to the cfg-preconditions for the two manual `unsafe impls`'s of `Send` and `Sync` for `TokenTree`.
Diffstat (limited to 'src/libsyntax/tokenstream.rs')
-rw-r--r--src/libsyntax/tokenstream.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs
index b32049b1da8..cd906bb282b 100644
--- a/src/libsyntax/tokenstream.rs
+++ b/src/libsyntax/tokenstream.rs
@@ -59,6 +59,17 @@ where
     TokenStream: Send + Sync,
 {}
 
+// These are safe since we ensure that they hold for all fields in the `_dummy` function.
+//
+// These impls are only here because the compiler takes forever to compute the Send and Sync
+// bounds without them.
+// FIXME: Remove these impls when the compiler can compute the bounds quickly again.
+// See https://github.com/rust-lang/rust/issues/60846
+#[cfg(all(bootstrap, parallel_compiler))]
+unsafe impl Send for TokenTree {}
+#[cfg(all(bootstrap, parallel_compiler))]
+unsafe impl Sync for TokenTree {}
+
 impl TokenTree {
     /// Use this token tree as a matcher to parse given tts.
     pub fn parse(cx: &base::ExtCtxt<'_>, mtch: &[quoted::TokenTree], tts: TokenStream)