Skip to content

Commit

Permalink
Add note about global state in try_print_query_stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 authored Sep 26, 2019
1 parent e9aa0e7 commit 97906bc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/librustc/ty/query/plumbing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 97906bc

Please sign in to comment.