Auto merge of #1475 - alexcrichton:update, r=huonw
Along the way, this also removes the ability to specify `[[lib]]` targets while
getting warnings. While we're at it remove nearly all unstable features that
Cargo is depending on as well!
Auto merge of #1452 - alexcrichton:issue-1355, r=huonw
The hashes would occasionally disappear when the main package registry overwrote
a previous registry source, so this just adds logic to load hashes if they're
missing.
Alex Crichton [Thu, 2 Apr 2015 18:12:21 +0000 (11:12 -0700)]
Update to rust-2015-04-02
Along the way, this also removes the ability to specify `[[lib]]` targets while
getting warnings. While we're at it remove nearly all unstable features that
Cargo is depending on as well!
bors [Tue, 31 Mar 2015 17:07:38 +0000 (17:07 +0000)]
Auto merge of #1455 - alexcrichton:issue-1449, r=brson
Previously --extern was passed for *all* upstream dependencies, causing
conflicts if some had duplicate names. Now cargo only passes --extern for
libraries that were built including immediate dependencies. Cargo also
additionally now properly passes `-L dependency=` instead of just a plain `-L`.
Alex Crichton [Wed, 25 Mar 2015 19:46:21 +0000 (12:46 -0700)]
Fix passing --extern and -L to doc tests
Previously --extern was passed for *all* upstream dependencies, causing
conflicts if some had duplicate names. Now cargo only passes --extern for
libraries that were built including immediate dependencies. Cargo also
additionally now properly passes `-L dependency=` instead of just a plain `-L`.
Alex Crichton [Wed, 25 Mar 2015 18:39:47 +0000 (11:39 -0700)]
Lazily load hashes for registry sources
The hashes would occasionally disappear when the main package registry overwrote
a previous registry source, so this just adds logic to load hashes if they're
missing.
bors [Wed, 25 Mar 2015 02:30:58 +0000 (02:30 +0000)]
Auto merge of #1443 - alexcrichton:hyphens-to-underscores, r=alexcrichton
This change allows *packages* to have hyphens in them, but they are always
translated to underscores when translated to a crate name. This means that all
crates are compiled with a `--crate-name` that has no hyphens (as well as
`--extern` directives having no hyphens).
Binaries and examples, however, are allowed to contain
hyphens in their name. The "crate name" will still have an underscore, but the
output will be in the same dasherized name.
Explicitly named targets are not allowed to have hyphens in them as well.
Alex Crichton [Fri, 20 Mar 2015 20:40:27 +0000 (13:40 -0700)]
Normalize hyphens to underscores in crate names
This change allows *packages* to have hyphens in them, but they are always
translated to underscores when translated to a crate name. This means that all
crates are compiled with a `--crate-name` that has no hyphens (as well as
`--extern` directives having no hyphens).
Binaries, examples, benchmarks, and tests, however, are allowed to contain
hyphens in their name. The "crate name" will still have an underscore, but the
output will be in the same dasherized name.
Explicitly named targets are not allowed to have hyphens in them as well.
bors [Tue, 24 Mar 2015 17:55:17 +0000 (17:55 +0000)]
Auto merge of #1444 - alexcrichton:issue-1398, r=huonw
This commit removes the ndebug support from Cargo and also adds a new
configuration option for profiles, `debug-assertions`, which controls whether
debug assertions in the compiler are turned on or not.
Alex Crichton [Tue, 24 Mar 2015 00:45:41 +0000 (17:45 -0700)]
Remove ndebug, add config of debug assertions
This commit removes the ndebug support from Cargo and also adds a new
configuration option for profiles, `debug-assertions`, which controls whether
debug assertions in the compiler are turned on or not.
bors [Tue, 24 Mar 2015 00:15:20 +0000 (00:15 +0000)]
Auto merge of #1441 - alexcrichton:issue-1323, r=bson
This commit is a complete overhaul of how Cargo handles compilation profiles
internally. The external interface of Cargo is not affected by this change.
Previously each Target had a Profile embedded within it. Conceptually a Target
is an entry in the manifest (a binary, benchmark, etc) and a Profile controlled
various flags (e.g. --test, -C opt-level, etc). Each Package then contained many
profiles for each possible compilation mode. For example a Package would have
one target for testing a library, benchmarking a library, documenting a library,
etc. When it came to building these targets, Cargo would filter out the targets
listed to determine what needed to be built.
This filtering was largely done based off an "environment" represented as a
string. Each mode of compilation got a separate environment string like `"test"`
or `"bench"`. Altogether, however, this approach had a number of drawbacks:
* Examples in release mode do not currently work. This is due to how examples
are classified and how release mode is handled (e.g. the "release" environment
where examples are meant to be built in the "test" environment).
* It is not trivial to implement `cargo test --release` today.
* It is not trivial to implement `cargo build --bin foo` where *only* the binary
`foo` is built. The same is true for examples.
* It is not trivial to add selective building of a number of
binaries/examples/etc.
* Filtering the list of targets to build has some pretty hokey logic that
involves pseudo-environments like "doc-all" vs "doc". This logic is duplicated
in a few places and in general is quite brittle.
* The TOML parser greatly affects compilation due to the time at which profiles
are generated, which seems somewhat backwards.
* Profiles must be overridden, but only partially, at compile time becuase only
the top-level package's profile is applied.
In general, this system just needed an overhaul. This commit made a single
change of separating `Profile` from `Target` and then basically hit `make` until
all the tests passed again. The other large architectural changes are:
* Environment strings are now entirely gone.
* Filters are implemented in a much more robust fashion.
* Release mode is now handled much more gracefully.
* The unit of compilation in the backend is no longer (package, target) but
rather (package, target, profile). This change had to be propagated many
location in the `cargo_rustc` module.
* The backend does not filter targets to build *at all*. All filtering now
happens entirely in the frontend.
I'll test issues after this change lands, but the motivation behind this is to
open the door to quickly fixing a number of outstanding issues against Cargo.
This change itself is not intended to close many bugs.
Alex Crichton [Sat, 21 Mar 2015 00:47:34 +0000 (17:47 -0700)]
Fix cargo test filtering for binaries
This adds a new `--bin` flag to `cargo test` to specifically say that a binary
should be tested. Additionally the dependencies are tweaked such that binaries
to not depend on themselves being available.
Alex Crichton [Thu, 19 Feb 2015 19:30:35 +0000 (11:30 -0800)]
Overhaul how cargo treats profiles
This commit is a complete overhaul of how Cargo handles compilation profiles
internally. The external interface of Cargo is not affected by this change.
Previously each Target had a Profile embedded within it. Conceptually a Target
is an entry in the manifest (a binary, benchmark, etc) and a Profile controlled
various flags (e.g. --test, -C opt-level, etc). Each Package then contained many
profiles for each possible compilation mode. For example a Package would have
one target for testing a library, benchmarking a library, documenting a library,
etc. When it came to building these targets, Cargo would filter out the targets
listed to determine what needed to be built.
This filtering was largely done based off an "environment" represented as a
string. Each mode of compilation got a separate environment string like `"test"`
or `"bench"`. Altogether, however, this approach had a number of drawbacks:
* Examples in release mode do not currently work. This is due to how examples
are classified and how release mode is handled (e.g. the "release" environment
where examples are meant to be built in the "test" environment).
* It is not trivial to implement `cargo test --release` today.
* It is not trivial to implement `cargo build --bin foo` where *only* the binary
`foo` is built. The same is true for examples.
* It is not trivial to add selective building of a number of
binaries/examples/etc.
* Filtering the list of targets to build has some pretty hokey logic that
involves pseudo-environments like "doc-all" vs "doc". This logic is duplicated
in a few places and in general is quite brittle.
* The TOML parser greatly affects compilation due to the time at which profiles
are generated, which seems somewhat backwards.
* Profiles must be overridden, but only partially, at compile time becuase only
the top-level package's profile is applied.
In general, this system just needed an overhaul. This commit made a single
change of separating `Profile` from `Target` and then basically hit `make` until
all the tests passed again. The other large architectural changes are:
* Environment strings are now entirely gone.
* Filters are implemented in a much more robust fashion.
* Release mode is now handled much more gracefully.
* The unit of compilation in the backend is no longer (package, target) but
rather (package, target, profile). This change had to be propagated many
location in the `cargo_rustc` module.
* The backend does not filter targets to build *at all*. All filtering now
happens entirely in the frontend.
I'll test issues after this change lands, but the motivation behind this is to
open the door to quickly fixing a number of outstanding issues against Cargo.
This change itself is not intended to close many bugs.
bors [Wed, 18 Mar 2015 18:07:53 +0000 (18:07 +0000)]
Auto merge of #1431 - IvanUkhov:newlines, r=alexcrichton
Hi,
It seems that people generally prefer not having newlines after section headers in their `Cargo.toml`s. However, when one creates a new package via `cargo new`, a newline gets automatically inserted after `[package]`. Then a typical `Cargo.toml` ends up being some what inconsistent: there is a newline after `[package]`, and there are no newlines after other headers.
On top of that, the examples given on crates.io do not seem to be consistent: [sometimes](http://doc.crates.io/index.html) there is a newline after `[package]`, and [sometimes](http://doc.crates.io/manifest.html) there is none. The same applies to other section names.
I am wondering if there should be some style conventions in this regard.
bors [Sat, 14 Mar 2015 18:01:07 +0000 (18:01 +0000)]
Auto merge of #1402 - cmr:issue-1015, r=alexcrichton
Deprecates the rustc-args metadata keyword in favor of rustc-link-lib and
rustc-link-search, which are more precise and allows for easy, correct
handling of spaces in pathnames.
Corey Richardson [Tue, 10 Mar 2015 17:12:47 +0000 (13:12 -0400)]
Add dedicated metadata for adding -l/-L flags
Deprecates the rustc-args metadata keyword in favor of rustc-link-lib and
rustc-link-search, which are more precise and allows for easy, correct
handling of spaces in pathnames.
bors [Thu, 12 Mar 2015 02:41:03 +0000 (02:41 +0000)]
Auto merge of #1409 - alexcrichton:less-compiles, r=huonw
This was previously required to ensure that all relevant metadata files would
remain in place and not get deleted, but this auto-clean behavior has since been
removed so this should no longer be necessary.
bors [Thu, 12 Mar 2015 02:29:59 +0000 (02:29 +0000)]
Auto merge of #1406 - alexcrichton:issue-1404, r=wycats
When loading targets to compile, be sure to use the targets from the package
that's being passed down to the compilation step, not the one that was passed in
which is overridden.
bors [Thu, 12 Mar 2015 02:17:26 +0000 (02:17 +0000)]
Auto merge of #1410 - johnz133:patch-2, r=huonw
cargo build now outputs to /target/debug, changed doc to reflect that.
steve suggested to add description for cargo build --release
autogenerates to guide.html. Used pre and code tags instead of ``` by following previous examples.
Alex Crichton [Thu, 12 Mar 2015 01:33:17 +0000 (18:33 -0700)]
Don't add non-compiled packages to the graph
This was previously required to ensure that all relevant metadata files would
remain in place and not get deleted, but this auto-clean behavior has since been
removed so this should no longer be necessary.
Alex Crichton [Wed, 11 Mar 2015 20:32:59 +0000 (13:32 -0700)]
Don't intermingle targets between packages
When loading targets to compile, be sure to use the targets from the package
that's being passed down to the compilation step, not the one that was passed in
which is overridden.
bors [Tue, 10 Mar 2015 03:42:12 +0000 (03:42 +0000)]
Auto merge of #1396 - alexcrichton:issue-1390, r=huonw
When calculating the output directory filename, only use the "file name"
component of the target triple specified as otherwise the output could be placed
into an odd location.
Alex Crichton [Mon, 9 Mar 2015 16:49:33 +0000 (09:49 -0700)]
Improve experience with the flexible target specification
When calculating the output directory filename, only use the "file name"
component of the target triple specified as otherwise the output could be placed
into an odd location.
bors [Mon, 9 Mar 2015 22:54:10 +0000 (22:54 +0000)]
Auto merge of #1395 - alexcrichton:profile, r=brson
* Don't use `{:?}` in profiling output, it's too noisy
* Allow an integer to be specified with `CARGO_PROFILE` indicating how many
levels deep should be printed.
Alex Crichton [Mon, 9 Mar 2015 16:45:40 +0000 (09:45 -0700)]
Improve the profiling output of Cargo
* Don't use `{:?}` in profiling output, it's too noisy
* Allow an integer to be specified with `CARGO_PROFILE` indicating how many
levels deep should be printed.