]> git.lizzy.rs Git - rust.git/commit
isolate dep-graph tasks
authorNiko Matsakis <niko@alum.mit.edu>
Mon, 6 Mar 2017 20:35:34 +0000 (15:35 -0500)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 10 Mar 2017 16:15:13 +0000 (08:15 -0800)
commit4b6b544d6512bfac7c926b3d93246fd14a56eb1d
treea60887eea57ab602270514f4b2216cc011395fca
parentf573db4f80c75f156df8a743f456bf087ec81dc2
isolate dep-graph tasks

A task function is now given as a `fn` pointer to ensure that it carries
no state. Each fn can take two arguments, because that worked out to be
convenient -- these two arguments must be of some type that is
`DepGraphSafe`, a new trait that is intended to prevent "leaking"
information into the task that was derived from tracked state.

This intentionally leaves `DepGraph::in_task()`, the more common form,
alone. Eventually all uses of `DepGraph::in_task()` should be ported
to `with_task()`, but I wanted to start with a smaller subset.

Originally I wanted to use closures bound by an auto trait, but that
approach has some limitations:

- the trait cannot have a `read()` method; since the current method
  is unused, that may not be a problem.
- more importantly, we would want the auto trait to be "undefined" for all types
  *by default* -- that is, this use case doesn't really fit the typical
  auto trait scenario. For example, imagine that there is a `u32` loaded
  out of a `hir::Node` -- we don't really want to be passing that
  `u32` into the task!
src/librustc/dep_graph/graph.rs
src/librustc/dep_graph/mod.rs
src/librustc/dep_graph/safe.rs [new file with mode: 0644]
src/librustc/lib.rs
src/librustc_borrowck/borrowck/mod.rs
src/librustc_incremental/persist/load.rs
src/librustc_mir/mir_map.rs
src/librustc_trans/base.rs
src/librustc_trans/context.rs
src/librustc_typeck/check/mod.rs
src/librustc_typeck/collect.rs