about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2019-09-26 16:55:07 -0400
committerGitHub <noreply@github.com>2019-09-26 16:55:07 -0400
commit97906bcd5c9c5ba5d165c7330b2ee062a97f11cf (patch)
treeee1cbed4345856fe445218a8cd7455a77445bee9
parente9aa0e7540b2bc0e644dde84aeca41d055e7511f (diff)
downloadrust-97906bcd5c9c5ba5d165c7330b2ee062a97f11cf.tar.gz
rust-97906bcd5c9c5ba5d165c7330b2ee062a97f11cf.zip
Add note about global state in try_print_query_stack
-rw-r--r--src/librustc/ty/query/plumbing.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs
index e2dff46d18b..d3e6789b826 100644
--- a/src/librustc/ty/query/plumbing.rs
+++ b/src/librustc/ty/query/plumbing.rs
@@ -325,6 +325,9 @@ impl<'tcx> TyCtxt<'tcx> {
     pub fn try_print_query_stack(handler: &Handler) {
         eprintln!("query stack during panic:");
 
+        // Be careful reyling on global state here: this code is called from
+        // a panic hook, which means that the global `Handler` may be in a weird
+        // state if it was responsible for triggering the panic.
         tls::with_context_opt(|icx| {
             if let Some(icx) = icx {
                 let mut current_query = icx.query.clone();