Replace duplicate code for loading project manifest
auto merge of #253 : jdeseno/cargo/find-root-manifest, r=alexcrichton

A few of the sub-commands seem to use the same code for loading the project manifest.

I'd like to get rid of the nested matches but, I can't figure how to use something like `and_then` & `or_else` where the type is promoted (Option -> CargoResult etc.)
Ensure LD_LIBRARY_PATH is correct for plugins

At runtime rustc will dlopen() plugins, and if plugins have dynamic dependencies
they're likely to be in target/deps, so we need to make sure that directory is
in the right search path.
auto merge of #257 : alexcrichton/cargo/ld-lib-path, r=wycats

At runtime rustc will dlopen() plugins, and if plugins have dynamic dependencies
they're likely to be in target/deps, so we need to make sure that directory is
in the right search path.
Base get_fingerprint on a PackageId

The fingerprinting code was erroneously using all sources from a manifest when
calculating the fingerprint which meant that sources not yet downloaded were
attempted to be fingerprinted.

The correct source to fingerprint is located in the SourceId field of the
resolved PackageId.

Closes #259
auto merge of #260 : alexcrichton/cargo/issue-229, r=wycats

The fingerprinting code was erroneously using all sources from a manifest when
calculating the fingerprint which meant that sources not yet downloaded were
attempted to be fingerprinted.

The correct source to fingerprint is located in the SourceId field of the
resolved PackageId.

Closes #259
Pass in initialized Source types into compile op
auto merge of #263 : rust-lang/cargo/transitive-deps-unfiltered, r=wycats
Print a message when a command receives a signal

Receiving a signal is normally indicative of violent termination, so the
subcommand can't be relied upon to have printed some status information. As a
result, signals now have some extra errors printed to stderr when they fail.

Closes #261. The actual signal is still a bug, but it's an upstream rust bug.
Inherit stdin when using `cargo run`

Previously a pipe was made which could mess with stdin like in #267.

Closes #267
Bootstrap cargo with cargo
auto merge of #256 : alexcrichton/cargo/bootstrap, r=wycats

This is extracted from #234 for sanity.

Cargo will inevitably pick up more dependencies over time such as flate compression, tarfile management, an external liburl, etc. These dependencies quickly get out of hand when using submodules, and it's much easier to rely on cargo to just build all these projects.

This is strategy is not guaranteed to work 100% of the time as rust's bootstrapping strategy does. The version of rust being used for a snapshot is not locked down, and a snapshot is not necessarily compatible with all versions of rust. In the worse case scenario we can either create a wrapper `rustc` to be compatible with the last snapshot, or we can have an escape hatch to build everything with Makefiles manually.

This transition seems inevitable, however, and it seems prudent to get the process underway sooner rather than later to smooth out the kinks.
Add a cargo-doc command
Correctly discover exe suffix through rustc

There was a bug when this was written in rustc that prevented this, but it has
since been fixed.
auto merge of #276 : alexcrichton/cargo/fix-exe, r=carllerche

There was a bug when this was written in rustc that prevented this, but it has
since been fixed.
auto merge of #265 : alexcrichton/cargo/issue-261, r=wycats

Receiving a signal is normally indicative of violent termination, so the
subcommand can't be relied upon to have printed some status information. As a
result, signals now have some extra errors printed to stderr when they fail.

Closes #261. The actual signal is still a bug, but it's an upstream rust bug.
auto merge of #254 : alexcrichton/cargo/cargo-doc, r=wycats

This is blocked until https://github.com/rust-lang/rust/pull/15939 lands, but in the meantime I figured I could get some eyes on this to make sure I'm sane.

Closes #130
auto merge of #268 : alexcrichton/cargo/issue-267, r=wycats

Previously a pipe was made which could mess with stdin like in #267.

Closes #267
Move from hammer to docopt for option parsing

The hammer library currently has some shortcomings such as the inability to
document individual options. Additionally our handling with hammer of extra
arguments is dodgy at best currently.

This commit moves the repository to BurntSushi's docopt.rs library which seems
to more feature-complete at this time. Additionally, docopt has the great
benefit of a "document once, use everywhere" documentation strategy.

This migration solves two primary issues:

* Comprehensive and useful CLI documentation
* Gracefully handling flavorful combinations of arguments in odd combinations

Closes #218
auto merge of #266 : alexcrichton/cargo/docopt, r=wycats

The hammer library currently has some shortcomings such as the inability to
document individual options. Additionally our handling with hammer of extra
arguments is dodgy at best currently.

This commit moves the repository to BurntSushi's docopt.rs library which seems
to more feature-complete at this time. Additionally, docopt has the great
benefit of a "document once, use everywhere" documentation strategy.

This migration solves two primary issues:

* Comprehensive and useful CLI documentation
* Gracefully handling flavorful combinations of arguments in odd combinations