Skip to content

Commit bfd42e9

Browse files
committed
Add a comment about the need of GCX_PTR
1 parent f4cecad commit bfd42e9

File tree

1 file changed

+4
-0
lines changed
  • compiler/rustc_middle/src/ty/context

1 file changed

+4
-0
lines changed

compiler/rustc_middle/src/ty/context/tls.rs

+4
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ impl GcxPtr {
199199

200200
unsafe impl Sync for GcxPtr {}
201201

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

0 commit comments

Comments
 (0)