MCPcopy Create free account
hub / github.com/Rust-for-Linux/klint / cx

Function cx

src/driver.rs:225–232  ·  view source on GitHub ↗

Obtain an extended context from `TyCtxt`.

(tcx: TyCtxt<'tcx>)

Source from the content-addressed store, hash-verified

223
224/// Obtain an extended context from `TyCtxt`.
225pub fn cx<'tcx, C: CallbacksExt>(tcx: TyCtxt<'tcx>) -> &'tcx C::ExtCtxt<'tcx> {
226 let tcx_addr = *tcx as *const _ as usize;
227 let guard = TCX_EXT_MAP.lock().unwrap();
228 let cx = guard.get(&tcx_addr).unwrap();
229 assert!(cx.is::<C::ExtCtxt<'static>>());
230 // SAFETY: we have checked that the type actually matches.
231 unsafe { &*(&raw const **cx as *const C::ExtCtxt<'tcx>) }
232}
233
234#[macro_export]
235macro_rules! hook_query {

Callers

nothing calls this directly

Calls 2

unwrapMethod · 0.80
lockMethod · 0.45

Tested by

no test coverage detected