Expand description

Throughout the compiler tree, there are several places which want to have access to state or queries while being inside crates that are dependencies of rustc_middle. To facilitate this, we have the rustc_data_structures::AtomicRef type, which allows us to setup a global static which can then be set in this file at program startup.

See SPAN_TRACK for an example of how to set things up.

The functions in this file should fall back to the default set in their origin crate when the TyCtxt is not present in TLS.

Functions

This is a callback from rustc_hir as it cannot access the implicit state in rustc_middle otherwise.
Sets up the callbacks in prior crates which we want to refer to the TyCtxt in.
This is a callback from rustc_ast as it cannot access the implicit state in rustc_middle otherwise. It is used when diagnostic messages are emitted and stores them in the current query, if there is one.