rustc_middle::ty::tls

Function with_related_context

source
pub fn with_related_context<'tcx, F, R>(tcx: TyCtxt<'tcx>, f: F) -> R
where F: FnOnce(&ImplicitCtxt<'_, 'tcx>) -> R,
Expand description

Allows access to the current ImplicitCtxt whose tcx field is the same as the tcx argument passed in. This means the closure is given an ImplicitCtxt with the same 'tcx lifetime as the TyCtxt passed in. This will panic if you pass it a TyCtxt which is different from the current ImplicitCtxt’s tcx field.