From b304272db08123c7e3d22ad80fb7a750359066a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Sat, 9 Sep 2023 15:20:05 +0200 Subject: [PATCH] Add a comment about the need of `GCX_PTR` --- compiler/rustc_middle/src/ty/context/tls.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler/rustc_middle/src/ty/context/tls.rs b/compiler/rustc_middle/src/ty/context/tls.rs index 2abc2b4dbafe..8f286a99a8e5 100644 --- a/compiler/rustc_middle/src/ty/context/tls.rs +++ b/compiler/rustc_middle/src/ty/context/tls.rs @@ -200,5 +200,9 @@ impl GcxPtr { unsafe impl Sync for GcxPtr {} scoped_tls::scoped_thread_local! { + /// 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. pub static GCX_PTR: GcxPtr }