about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorFelix S Klock II <pnkfelix@pnkfx.org>2019-06-13 12:05:18 +0200
committerGitHub <noreply@github.com>2019-06-13 12:05:18 +0200
commitbb97fe0bae0d4dcfd106e77a951ea8dbb4be2659 (patch)
tree5294190804510b58ed94abcc6a86e53e6f692a30 /src
parentcb8158d84737e2d36d3e785be494dc49756d6735 (diff)
downloadrust-bb97fe0bae0d4dcfd106e77a951ea8dbb4be2659.tar.gz
rust-bb97fe0bae0d4dcfd106e77a951ea8dbb4be2659.zip
revert change incorrectly identified as "hack"
put back negative impls to ensure `Span` is not `Send` nor `Sync`
Diffstat (limited to 'src')
-rw-r--r--src/libsyntax_pos/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs
index d81cb756b02..8f5595968a7 100644
--- a/src/libsyntax_pos/lib.rs
+++ b/src/libsyntax_pos/lib.rs
@@ -227,6 +227,14 @@ impl SpanData {
     }
 }
 
+// The interner is pointed to by a thread local value which is only set on the main thread
+// with parallelization is disabled. So we don't allow `Span` to transfer between threads
+// to avoid panics and other errors, even though it would be memory safe to do so.
+#[cfg(not(parallel_compiler))]
+impl !Send for Span {}
+#[cfg(not(parallel_compiler))]
+impl !Sync for Span {}
+
 impl PartialOrd for Span {
     fn partial_cmp(&self, rhs: &Self) -> Option<Ordering> {
         PartialOrd::partial_cmp(&self.data(), &rhs.data())