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
Fix running tests using git on systems with customized git templates

I customized my git repo template to default to the standard pre-commit
hook that checks for e.g. trailing whitespace and refuses to commit if
any trailing whitespace was found. This causes some of cargo's tests to
fail.

To be independent of the user's git template, create the repo for the
test without using any, by specifying an empty template.
auto merge of #325 : dotdash/cargo/git_no_template, r=alexcrichton

I customized my git repo template to default to the standard pre-commit
hook that checks for e.g. trailing whitespace and refuses to commit if
any trailing whitespace was found. This causes some of cargo's tests to
fail.

To be independent of the user's git template, create the repo for the
test without using any, by specifying an empty template.
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.
Lift the requirement that cargo is built with make

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.
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.