From bb97fe0bae0d4dcfd106e77a951ea8dbb4be2659 Mon Sep 17 00:00:00 2001 From: Felix S Klock II Date: Thu, 13 Jun 2019 12:05:18 +0200 Subject: [PATCH] revert change incorrectly identified as "hack" put back negative impls to ensure `Span` is not `Send` nor `Sync` --- src/libsyntax_pos/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index d81cb756b0296..8f5595968a738 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 { PartialOrd::partial_cmp(&self.data(), &rhs.data())