Allow documenting binary targets.

This removes the check in the compilation phase, but adds an error if you're
documenting a library and a binary with the same name (as the rustdoc output
would conflict).
Ignore Cargo.lock for libs in `cargo-new`

The lockfile should only be checked in for bins, not libs.

Closes #304
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.
Fix submodules on the initial checkout

The fast path bypassed updating the submodule which wasn't correct if we were
the first checkout.
Fix the output type of `staticlib`

The file-naming bits weren't handling the staticlib case
auto merge of #319 : alexcrichton/cargo/fix-staticlibs, r=wycats

The file-naming bits weren't handling the staticlib case
auto merge of #320 : alexcrichton/cargo/fix-doc-bins, r=wycats

This removes the check in the compilation phase, but adds an error if you're
documenting a library and a binary with the same name (as the rustdoc output
would conflict).

Closes #318
auto merge of #321 : alexcrichton/cargo/issue-304, r=wycats

The lockfile should only be checked in for bins, not libs.

Closes #304
auto merge of #328 : alexcrichton/cargo/cargo-building-cargo, r=wycats

Cargo should be able to build with cargo so others can depend on the cargo
library. This means that the one requirement of the CFG_VERSION env var will not
be available. This alters `version()` to prioritize CFG_VERSION but fall back to
the cargo-specified variables.
auto merge of #329 : alexcrichton/cargo/fix-git-submodule, r=wycats

The fast path bypassed updating the submodule which wasn't correct if we were
the first checkout.
Ensure env vars are set for cargo-doc

This erroneously used util::process instead of the custom process function in
the cargo_rustc module.
auto merge of #330 : alexcrichton/cargo/fix-cargo-doc2, r=wycats

This erroneously used util::process instead of the custom process function in
the cargo_rustc module.
auto merge of #302 : alexcrichton/cargo/doc-test, r=wycats

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.

Closes #334
Remove Location, use Url everywhere

Now that rust-url supports windows paths in URLs, this commit jettisons the
janky Location enum in favor of just using Url everywhere.
Remove the update_remotes flag entirely

This will inadvertently fix #337 as no lockfile will imply that all dependencies
are not precise, and will hence be fetched.
Unconditionally write Cargo.lock

Otherwise `cargo-update` ends up not doing much because all sources are
considered equal regardless of their precision.
Update rust-url with a contained bugfix
auto merge of #336 : alexcrichton/cargo/no-more-location, r=wycats

Now that rust-url supports windows paths in URLs, this commit jettisons the
janky Location enum in favor of just using Url everywhere.
Robustly run binaries and tests after compilation

These were previously just run by executing the raw binary, but this didn't
ensure that any of the necessary paths were in the dylib search path for the
host platform.

This commit enhances the return type of `compile_targets` to have information
about the result of compilation, along with the ability to spawn correctly
configured processes.

This primarily fixes `cargo test` and `cargo run` whenever dynamic dependencies
are involved, but it also fixes the two commands whenever there's a native
dynamic dependency involved as well.