/// Executes a job by changing the ImplicitCtxt to point to the
/// new query job while it executes. It returns the diagnostics
/// captured during execution and the actual result.
Executes a job by changing the ImplicitCtxt to point to the
new query job while it executes. It returns the diagnostics
captured during execution and the actual result.
Executes a job by changing the ImplicitCtxt to point to the new query job while it executes . It returns the diagnostics captured during execution and the actual result .
pub(super) fn start<'lcx, F, R>(
        &self,
        tcx: TyCtxt<'_, 'tcx, 'lcx>,
        compute: F)
    -> (R, Vec<Diagnostic>)
    where
        F: for<'b> FnOnce(TyCtxt<'b, 'tcx, 'lcx>) -> R
    {
        // The TyCtxt stored in TLS has the same global interner lifetime
        // as `tcx`, so we use `with_related_context` to relate the 'gcx lifetimes
        // when accessing the ImplicitCtxt
        let r = tls::with_related_context(tcx, move |current_icx| {
            // Update the ImplicitCtxt to point to our new query job
            let new_icx = tls::ImplicitCtxt {
                tcx,
                query: Some(self.job.clone()),
                layout_depth: current_icx.layout_depth,
                task: current_icx.task,
            };
            // Use the ImplicitCtxt while we execute the query
            tls::enter_context(&new_icx, |_| {
                compute(tcx)
            })
        });
        // Extract the diagnostic from the job
        let diagnostics = mem::replace(&mut *self.job.diagnostics.lock(), Vec::new());
        (r, diagnostics)
    }
pub ( super ) fn start < ' lcx , F , R > ( & self , tcx : TyCtxt < ' _ , ' tcx , ' lcx > , compute : F ) -> ( R , Vec < Diagnostic > ) where F : for < ' b > FnOnce ( TyCtxt < ' b , ' tcx , ' lcx > ) -> R { // The TyCtxt stored in TLS has the same global interner lifetime // as `tcx`, so we use `with_related_context` to relate the 'gcx lifetimes // when accessing the ImplicitCtxt let r = tls :: with_related_context ( tcx , move | current_icx | { // Update the ImplicitCtxt to point to our new query job let new_icx = tls :: ImplicitCtxt { tcx , query : Some ( self . job . clone ( ) ) , layout_depth : current_icx . layout_depth , task : current_icx . task , } ; // Use the ImplicitCtxt while we execute the query tls :: enter_context ( & new_icx , | _ | { compute ( tcx ) } ) } ) ; // Extract the diagnostic from the job let diagnostics = mem :: replace ( & mut * self . job . diagnostics . lock ( ) , Vec :: new ( ) ) ; ( r , diagnostics ) }
Executes a job by changing the ImplicitCtxt to point to the
new query job while it executes.
Executes a job by changing the ImplicitCtxt to point to the new query job while it executes .
&self
tcx
TyCtxt<'_, 'tcx, 'lcx>
compute
F