Fix the build.

After an upstream fix in docopt, cargo now builds on rust HEAD. Also,
move to the semver crate rather than the deprecated built-in one.
Make the dependency queue entirely generic

This paves the way for future intra-package parallelism as opposed to just
inter-package parallelism.
Power the TaskPool with a sync channel

This rate limits the jobs entering the pool to ensure that the number of
pending jobs is actually close to the number of cores. The current behavior is
to print all pending jobs, even when they're not executing, which may be
confusing.
Prepare for per-target fingerprints

This commit refactors all related infrastructure for the cargo_rustc module to
move the granularity of fingerprints from packages to targets. This involved
heavily modifying the `JobQueue` structure to understand a finer-grained target
for dirtiness propagation and dependency management, and then dealing with
fallout in the main module.

The fingerprint module has been refactored to support a per-target fingerprint.
A fallout of this change is that each build step has its own fingerprint,
including the custom build command step. This will be implemented in a future
commit.

As fallout of this reorganization, we are now exploiting the maximal parallelism
within packages themselves whereas before we were only partially parallelizing.
No new features were added as part of this commit, so I just ensured that all
the tests ran.
Implement per-target fingerprints

This commit refines the granularity of fingerprints from packages to targets,
building on the existing infrastructure. All invocations of rustc now include
the --dep-info flag which will emit makefile-like dependency information. This
information is then parsed later on to determine if all the files are fresh.

The purpose of this commit is to refine the set of files which indicate that a
target needs to be re-built. Before this commit if you modified a test it would
rebuild the entire library, but after this commit it only rebuilds the relevant
test.

Closes #214
Closes #289
Don't tromp over too many files when downloading the snapshot
Add a --enable-optimize flag to ./configure
Make freshness tests more robust with time travel

Add a helper function to forcibly move a tree back one hour so new edits are
picked up correctly.
auto merge of #294 : alexcrichton/cargo/here-we-go, r=wycats

This is a series of commits which culminate in fixing #214. The last remaining bit is that freshness for an entire package is still considered if the package has a `build` command, but that is pretty easy to fix and I plan on doing so soon-ish.
Fix distcheck with --enable-optimize
auto merge of #308 : alexcrichton/cargo/enable-optimize, r=alexcrichton
Refactor cargo_test into an ops module

The logic for doc tests will get a little complex, so this is moved to aseparate
module instead of inside the executable.
Implement doc tests

Whenever `cargo test` is run and a testable library target is available, the doc
tests will be run. This can be opted out of with `test = false` as usual.

This is currently not super useful due to rust-lang/rust#16157, but I expect
that to be merged soon. In the meantime examples will need to `extern crate foo`
explicitly.