Skip to content

Commit

Permalink
revert change incorrectly identified as "hack"
Browse files Browse the repository at this point in the history
put back negative impls to ensure `Span` is not `Send` nor `Sync`
  • Loading branch information
pnkfelix committed Jun 13, 2019
1 parent cb8158d commit bb97fe0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libsyntax_pos/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit bb97fe0

Please sign in to comment.