Since #318, the `doc` command generates documentation for binaries in addition to libraries. But currently running `cargo doc --open` would not launch the browser for binary-only packages, even though it should. This commit changes the logic: binaries will be searched when there are no libraries in the package.
A simple test case:
`Cargo.toml`:
[package]
name = "foo"
version = "0.1.0"
authors = []
Auto merge of #1519 - alfiedotwtf:master, r=alexcrichton
Currently getting:
note: /usr/bin/ld: /home/alfie/tmp/test/target/debug/build/test-39af07f97c17512a/out/libhello.a(hello.o):
relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
Alfie John [Mon, 13 Apr 2015 12:36:32 +0000 (22:36 +1000)]
docs: fix shared library compilation error
Currently getting:
note: /usr/bin/ld: /home/alfie/tmp/test/target/debug/build/test-39af07f97c17512a/out/libhello.a(hello.o):
relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
Auto merge of #1507 - jimmycuadra:cargo-new-semver, r=alexcrichton
This patch updates the initial version of packages generated with `cargo new` to 0.1.0 (rather than 0.0.1), which better follows SemVer. The docs are also updated to show examples that follow this convention.
For reference, the same change was recently made in Bundler for the Ruby ecosystem: bundler/bundler#3322
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.