about summary refs log tree commit diff
path: root/src/libsyntax_pos
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2018-03-23 09:27:19 -0500
committerAlex Crichton <alex@alexcrichton.com>2018-03-23 10:16:09 -0700
commit4b31b5bda75ee7be63aa5aa146d75bbacb3faa4b (patch)
tree8d9dd13645c9c9ba1856c365de32002dfbe2452e /src/libsyntax_pos
parentf74d01cf29adc11b1bda3ca73537c49dcbb60c52 (diff)
parente09c2ff3f85b428cd8283a7f7d9b38843bbc95a9 (diff)
downloadrust-4b31b5bda75ee7be63aa5aa146d75bbacb3faa4b.tar.gz
rust-4b31b5bda75ee7be63aa5aa146d75bbacb3faa4b.zip
Rollup merge of #49030 - Zoxc:misc, r=michaelwoerister
Misc changes from my parallel rustc branch

r? @michaelwoerister
Diffstat (limited to 'src/libsyntax_pos')
-rw-r--r--src/libsyntax_pos/lib.rs6
-rw-r--r--src/libsyntax_pos/symbol.rs6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs
index 9b83d5510fb..5a7b7e9ceca 100644
--- a/src/libsyntax_pos/lib.rs
+++ b/src/libsyntax_pos/lib.rs
@@ -184,8 +184,12 @@ impl SpanData {
     }
 }
 
-// The interner in thread-local, so `Span` shouldn't move between threads.
+// 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_queries))]
 impl !Send for Span {}
+#[cfg(not(parallel_queries))]
 impl !Sync for Span {}
 
 impl PartialOrd for Span {
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs
index 0cba094da64..098eafef258 100644
--- a/src/libsyntax_pos/symbol.rs
+++ b/src/libsyntax_pos/symbol.rs
@@ -83,8 +83,12 @@ impl Decodable for Ident {
 #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
 pub struct Symbol(u32);
 
-// The interner in thread-local, so `Symbol` shouldn't move between threads.
+// 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 Symbol to transfer between threads
+// to avoid panics and other errors, even though it would be memory safe to do so.
+#[cfg(not(parallel_queries))]
 impl !Send for Symbol { }
+#[cfg(not(parallel_queries))]
 impl !Sync for Symbol { }
 
 impl Symbol {