Skip to content

Commit bb97fe0

Browse files
authored
revert change incorrectly identified as "hack"
put back negative impls to ensure `Span` is not `Send` nor `Sync`
1 parent cb8158d commit bb97fe0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libsyntax_pos/lib.rs

+8
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,14 @@ impl SpanData {
227227
}
228228
}
229229

230+
// The interner is pointed to by a thread local value which is only set on the main thread
231+
// with parallelization is disabled. So we don't allow `Span` to transfer between threads
232+
// to avoid panics and other errors, even though it would be memory safe to do so.
233+
#[cfg(not(parallel_compiler))]
234+
impl !Send for Span {}
235+
#[cfg(not(parallel_compiler))]
236+
impl !Sync for Span {}
237+
230238
impl PartialOrd for Span {
231239
fn partial_cmp(&self, rhs: &Self) -> Option<Ordering> {
232240
PartialOrd::partial_cmp(&self.data(), &rhs.data())

0 commit comments

Comments
 (0)