Skip to content

Commit

Permalink
Add a comment about the need of GCX_PTR
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Sep 9, 2023
1 parent f4cecad commit bfd42e9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_middle/src/ty/context/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ impl GcxPtr {

unsafe impl Sync for GcxPtr {}

/// This is needed to allow the deadlock handler access to `GlobalCtxt` to look for query cycles.
/// It cannot use the `TLV` global is that's only guaranteed to be defined on the thread creating
/// the `GlobalCtxt`. Other thread have access to the `TLV` only inside Rayon jobs, but the
/// deadlock handler is not called inside such a job.
scoped_tls::scoped_thread_local! {
pub static GCX_PTR: GcxPtr
}

0 comments on commit bfd42e9

Please sign in to comment.