pub fn with_task<'gcx, C, A, R>(&self,
                                   key: DepNode,
                                   cx: C,
                                   arg: A,
                                   task: fn(C, A) -> R)
                                   -> (R, DepNodeIndex)
        where C: DepGraphSafe + StableHashingContextProvider<'gcx>,
              R: HashStable<StableHashingContext<'gcx>>,
    {
        self.with_task_impl(key, cx, arg, false, task,
            |key| OpenTask::Regular(Lock::new(RegularOpenTask {
                node: key,
                reads: SmallVec::new(),
                read_set: Default::default(),
            })),
            |data, key, fingerprint, task| data.borrow_mut().complete_task(key, task, fingerprint))
    }
/// Starts a new dep-graph task. Dep-graph tasks are specified
/// using a free function (`task`) and **not** a closure -- this
/// is intentional because we want to exercise tight control over
/// what state they have access to. In particular, we want to
/// prevent implicit 'leaks' of tracked state into the task (which
/// could then be read without generating correct edges in the
/// dep-graph -- see the [rustc guide] for more details on
/// the dep-graph). To this end, the task function gets exactly two
/// pieces of state: the context `cx` and an argument `arg`. Both
/// of these bits of state must be of some type that implements
/// `DepGraphSafe` and hence does not leak.
///
/// The choice of two arguments is not fundamental. One argument
/// would work just as well, since multiple values can be
/// collected using tuples. However, using two arguments works out
/// to be quite convenient, since it is common to need a context
/// (`cx`) and some argument (e.g., a `DefId` identifying what
/// item to process).
///
/// For cases where you need some other number of arguments:
///
/// - If you only need one argument, just use `()` for the `arg`
///   parameter.
/// - If you need 3+ arguments, use a tuple for the
///   `arg` parameter.
///
/// [rustc guide]: https://rust-lang.github.io/rustc-guide/incremental-compilation.html
Starts a new dep-graph task. Dep-graph tasks are specified
using a free function (`task`) and **not** a closure -- this
is intentional because we want to exercise tight control over
what state they have access to. In particular, we want to
prevent implicit 'leaks' of tracked state into the task (which
could then be read without generating correct edges in the
dep-graph -- see the [rustc guide] for more details on
the dep-graph). To this end, the task function gets exactly two
pieces of state: the context `cx` and an argument `arg`. Both
of these bits of state must be of some type that implements
`DepGraphSafe` and hence does not leak.

The choice of two arguments is not fundamental. One argument
would work just as well, since multiple values can be
collected using tuples. However, using two arguments works out
to be quite convenient, since it is common to need a context
(`cx`) and some argument .

For cases where you need some other number of arguments.

If you only need one argument, just use `()` for the `arg`
parameter.
If you need 3+ arguments, use a tuple for the
`arg` parameter.


Starts a new dep - graph task . Dep - graph tasks are specified using a free function ( ` task ` ) and ** not ** a closure -- this is intentional because we want to exercise tight control over what state they have access to . In particular we want to prevent implicit ' leaks ' of tracked state into the task ( which could then be read without generating correct edges in the dep - graph -- see the [ rustc guide ] for more details on the dep - graph ) . To this end the task function gets exactly two pieces of state : the context ` cx ` and an argument ` arg ` . Both of these bits of state must be of some type that implements ` DepGraphSafe ` and hence does not leak . The choice of two arguments is not fundamental . One argument would work just as well since multiple values can be collected using tuples . However using two arguments works out to be quite convenient since it is common to need a context ( ` cx ` ) and some argument . For cases where you need some other number of arguments . If you only need one argument just use ` () ` for the ` arg ` parameter . If you need 3 + arguments use a tuple for the ` arg ` parameter .
pub fn with_task<'gcx, C, A, R>(&self,
                                   key: DepNode,
                                   cx: C,
                                   arg: A,
                                   task: fn(C, A) -> R)
                                   -> (R, DepNodeIndex)
        where C: DepGraphSafe + StableHashingContextProvider<'gcx>,
              R: HashStable<StableHashingContext<'gcx>>,
    {
        self.with_task_impl(key, cx, arg, false, task,
            |key| OpenTask::Regular(Lock::new(RegularOpenTask {
                node: key,
                reads: SmallVec::new(),
                read_set: Default::default(),
            })),
            |data, key, fingerprint, task| data.borrow_mut().complete_task(key, task, fingerprint))
    }
pub fn with_task < ' gcx , C , A , R > ( & self , key : DepNode , cx : C , arg : A , task : fn ( C , A ) -> R ) -> ( R , DepNodeIndex ) where C : DepGraphSafe + StableHashingContextProvider < ' gcx > , R : HashStable < StableHashingContext < ' gcx > > , { self . with_task_impl ( key , cx , arg , false , task , | key | OpenTask :: Regular ( Lock :: new ( RegularOpenTask { node : key , reads : SmallVec :: new ( ) , read_set : Default :: default ( ) , } ) ) , | data , key , fingerprint , task | data . borrow_mut ( ) . complete_task ( key , task , fingerprint ) ) }
Starts a new dep-graph task.
Starts a new dep - graph task .
&self
key
DepNode
cx
C
arg
A
task
fn(C, A) -> R
&self
key
DepNode
cx
C
arg
A
task
fn(C, A) -> R