[−][src]Module rustc_interface::callbacks

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 librustc_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_DEBUG 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

def_id_debug

This is a callback from librustc_hir as it cannot access the implicit state in librustc_middle otherwise.

setup_callbacks

Sets up the callbacks in prior crates which we want to refer to the TyCtxt in.

span_debug

This is a callback from librustc_ast as it cannot access the implicit state in librustc_middle otherwise.

track_diagnostic

This is a callback from librustc_ast as it cannot access the implicit state in librustc_middle otherwise. It is used to when diagnostic messages are emitted and stores them in the current query, if there is one.