Dirkjan Ochtman [Fri, 13 Apr 2018 17:43:35 +0000 (19:43 +0200)]
Remove requested_target() method from Context
Favor accessing cx.build_config directly.
Dirkjan Ochtman [Fri, 13 Apr 2018 17:59:55 +0000 (19:59 +0200)]
Correct formatting with cargo fmt
bors [Fri, 13 Apr 2018 16:28:23 +0000 (16:28 +0000)]
Auto merge of #5353 - matklad:features, r=alexcrichton
New semantics for `--features` flag
Historically, feature-related flags like `--all-features`,
`--no-default-features` and `--features` operated on the *current*
package. That is, `cargo --package foo --feature feat` would activate
`feat` for the package at the current working directory, and not for the
`foo` package. `-Z package-features` flag implements the more obvious
semantics for this combination of flags. This changes behavior, and that
is why we want to start with an unstable opt-in. The changes are:
* `--feature` flag affects the selected package. It is an error to
specify `--feature` with more than a single `-p`, or with `-p` outside
workspace (the latter could work in theory, but would be hard to
implement).
* `--all-features` and `--no-default-features` affect all selected
packages, and not the one at cwd.
* The package in `cwd` is not implicitly enabled when doing feature
selection. That is, `cargo build -Z package-features -p foo` could
select *less* features for various packages than `cargo build -p foo`.
r? @alexcrichton
Aleksey Kladov [Fri, 13 Apr 2018 14:36:09 +0000 (17:36 +0300)]
New semantics for `--features` flag
Historically, feature-related flags like `--all-features`,
`--no-default-features` and `--features` operated on the *current*
package. That is, `cargo --package foo --feature feat` would activate
`feat` for the package at the current working directory, and not for the
`foo` package. `-Z package-features` flag implements the more obvious
semantics for this combination of flags. This changes behavior, and that
is why we want to start with an unstable opt-in. The changes are:
* `--feature` flag affects the selected package. It is an error to
specify `--feature` with more than a single `-p`, or with `-p` outside
workspace (the latter could work in theory, but would be hard to
implement).
* `--all-features` and `--no-default-features` affect all selected
packages, and not the one at cwd.
* The package in `cwd` is not implicitly enabled when doing feature
selection. That is, `cargo build -Z package-features -p foo` could
select *less* features for various packages than `cargo build -p foo`.
bors [Thu, 12 Apr 2018 11:16:51 +0000 (11:16 +0000)]
Auto merge of #5350 - matklad:simplify-install, r=djc
Simplify install
Just a mechanical simplification.
bors [Thu, 12 Apr 2018 10:44:05 +0000 (10:44 +0000)]
Auto merge of #5352 - surma-dump:what-is-a-manifest, r=matklad
Mention Cargo.toml in manifest help description
I was looking for a CLI flag to pass a different TOML to cargo, but didn’t realize it’s called “manifest” from reading the help.
Surma [Thu, 12 Apr 2018 10:42:19 +0000 (12:42 +0200)]
Remove parens
Surma [Thu, 12 Apr 2018 10:30:42 +0000 (12:30 +0200)]
Mention Cargo.toml in manifest help description
bors [Thu, 12 Apr 2018 08:00:38 +0000 (08:00 +0000)]
Auto merge of #5346 - derekdreery:package_id_docs, r=matklad
Add docs
Just adds some docs matching what @matklad told me on irc :)
Richard Dodd (dodj) [Thu, 12 Apr 2018 07:32:53 +0000 (08:32 +0100)]
remove getter/setter docs
Aleksey Kladov [Thu, 12 Apr 2018 06:06:09 +0000 (09:06 +0300)]
Cleanup formatting
Aleksey Kladov [Thu, 12 Apr 2018 06:04:46 +0000 (09:04 +0300)]
Minor simplification
bors [Thu, 12 Apr 2018 00:03:59 +0000 (00:03 +0000)]
Auto merge of #5348 - djc:resolve-target-specific, r=alexcrichton
Have compilation context info available earlier in the build process
Eventually, I hope this will allow us to ignore platform-specific dependencies when irrelevant for the current build earlier in the process. This should save on extraneous errors. As is, this seems like it already decreases coupling in the code base.
Dirkjan Ochtman [Wed, 11 Apr 2018 23:08:01 +0000 (01:08 +0200)]
Move compiler driver code from ops into core
Dirkjan Ochtman [Wed, 11 Apr 2018 22:49:56 +0000 (00:49 +0200)]
Use relative dependencies inside cargo_rustc module
Dirkjan Ochtman [Wed, 11 Apr 2018 22:37:30 +0000 (00:37 +0200)]
Use Unit type as interface to compilation
Dirkjan Ochtman [Wed, 11 Apr 2018 22:29:24 +0000 (00:29 +0200)]
Move cargo_rustc::compile_targets() to Context::compile()
Dirkjan Ochtman [Wed, 11 Apr 2018 20:50:07 +0000 (22:50 +0200)]
Hoist Context creation out of compile_targets()
Dirkjan Ochtman [Wed, 11 Apr 2018 20:25:05 +0000 (22:25 +0200)]
Deliver units to compilation Context after initialization
Dirkjan Ochtman [Wed, 11 Apr 2018 22:04:58 +0000 (00:04 +0200)]
Error out early on empty targets
Dirkjan Ochtman [Wed, 11 Apr 2018 21:55:01 +0000 (23:55 +0200)]
Initialize BuildConfig in a single place
Dirkjan Ochtman [Wed, 11 Apr 2018 21:44:58 +0000 (23:44 +0200)]
Inline single use variable binding
Dirkjan Ochtman [Wed, 11 Apr 2018 14:05:28 +0000 (16:05 +0200)]
Process build configuration before resolving dependencies
Dirkjan Ochtman [Wed, 11 Apr 2018 21:16:17 +0000 (23:16 +0200)]
Correct formatting with cargo fmt
Richard Dodd [Wed, 11 Apr 2018 16:42:52 +0000 (17:42 +0100)]
Add docs
bors [Wed, 11 Apr 2018 14:08:13 +0000 (14:08 +0000)]
Auto merge of #5341 - dwijnand:test-help, r=alexcrichton
tweak test/bench's help around filtering & libtest
Attempt to bring more clarity about test/bench's filtering arg by
detailing the distinction and integration between cargo's test/bench and
libtest.
Also make sure to mention how to see libtest's help/usage message.
Fixes #5337
Feedback welcome. Also, how do I auto-generate the man pages in
src/etc/man/? I'm wasn't sure about the escaping to attempt manually
editing.
bors [Wed, 11 Apr 2018 11:44:20 +0000 (11:44 +0000)]
Auto merge of #5343 - dwijnand:contributing-fmt, r=matklad
add a rustfmt detail to CONTRIBUTING.md
stealing from the info in https://github.com/rust-lang/cargo/pull/5301#issuecomment-
380389555
Dale Wijnand [Wed, 11 Apr 2018 11:39:08 +0000 (12:39 +0100)]
add a rustfmt detail to CONTRIBUTING.md
Dale Wijnand [Wed, 11 Apr 2018 06:39:13 +0000 (07:39 +0100)]
tweak test/bench's help around filtering & libtest
Attempt to bring more clarity about test/bench's filtering arg by
detailing the distinction and integration between cargo's test/bench and
libtest.
Also make sure to mention how to see libtest's help/usage message.
Fixes #5337
bors [Wed, 11 Apr 2018 05:04:28 +0000 (05:04 +0000)]
Auto merge of #5333 - dwijnand:warn-install-2018, r=matklad
Warn/error when cargo installing the cwd in 2015/2018
Fixes #5327
submitted for early review. feedback very welcome, I'm happy to iterate (and learn).
Dale Wijnand [Tue, 10 Apr 2018 15:34:41 +0000 (16:34 +0100)]
more cargo install usage adaptations in the same tests
Dale Wijnand [Tue, 10 Apr 2018 15:05:18 +0000 (16:05 +0100)]
adapt legitimate cargo install usage to avoid the new warning/error
Dale Wijnand [Tue, 10 Apr 2018 14:13:26 +0000 (15:13 +0100)]
add the inverse `is_not has_installed_exe` assertion
Dale Wijnand [Tue, 10 Apr 2018 14:10:38 +0000 (15:10 +0100)]
warn in 2015, error in 2018
Dale Wijnand [Tue, 10 Apr 2018 12:32:40 +0000 (13:32 +0100)]
re-implement by adding a few from_cwd args
Dale Wijnand [Tue, 10 Apr 2018 07:16:57 +0000 (08:16 +0100)]
found a way to reuse SourceId::for_path in SourceId::from_cwd
Dale Wijnand [Tue, 10 Apr 2018 05:48:00 +0000 (06:48 +0100)]
document SourceId::from_cwd
Dale Wijnand [Tue, 10 Apr 2018 05:44:59 +0000 (06:44 +0100)]
enable cargo edition feature & bump to 2018
Dale Wijnand [Tue, 10 Apr 2018 00:37:12 +0000 (01:37 +0100)]
Warn about cargo installing the cwd in 2018 edition
Fixes #5327
bors [Mon, 9 Apr 2018 22:04:05 +0000 (22:04 +0000)]
Auto merge of #5331 - dwijnand:contributing-fmt, r=matklad
Tweak rustfmt details in CONTRIBUTING.md
Closes #5329
Dale Wijnand [Mon, 9 Apr 2018 21:59:31 +0000 (22:59 +0100)]
Tweak rustfmt details in CONTRIBUTING.md
Closes #5329
bors [Mon, 9 Apr 2018 20:30:49 +0000 (20:30 +0000)]
Auto merge of #5328 - dwijnand:doc-links-key, r=matklad
Add a reference to the links key in the manifest docs
Fixes #4975
Dale Wijnand [Mon, 9 Apr 2018 20:27:34 +0000 (21:27 +0100)]
Add a references to the links key in the manifest docs
Fixes #4975
bors [Mon, 9 Apr 2018 18:41:15 +0000 (18:41 +0000)]
Auto merge of #5325 - dwijnand:patch-1, r=matklad
Fix link to I-nominated in CONTRIBUTING.md
Dale Wijnand [Mon, 9 Apr 2018 18:38:58 +0000 (19:38 +0100)]
Fix link to I-nominated in CONTRIBUTING.md
bors [Mon, 9 Apr 2018 13:19:05 +0000 (13:19 +0000)]
Auto merge of #5323 - matklad:document-good-stuff, r=alexcrichton
Document how to use Cargo's internal logging
I always forget the syntax for filtering by module, and I've learned about `CARGO_PROFILE` yesterday, so let's document these for other contributors as well :-)
bors [Sun, 8 Apr 2018 22:02:15 +0000 (22:02 +0000)]
Auto merge of #5318 - ehuss:unstable-docs, r=matklad
Add unstable documentation.
I kept most of these relatively brief with the intent that more complete
documentation would be added when a feature is stabilized. I did my best to be
accurate, but I am unfamiliar with most of these features, so please let me know
if anything should change.
@matklad: I didn't fully understand the use case for `minimal-versions`, so I
didn't say much about it. In particular, I didn't understand why one wouldn't
just use `~` or `=` semver requirements if you wanted to be careful about not
pulling in a newer version. When someone says "1.0", aren't they explicitly
saying they want a newer version (up to 2.0) if it's available? The example
in the RFC of switching a dependency to "=1.0" sounds like a breaking change
(essentially downgrading a dependency).
Eric Huss [Sun, 8 Apr 2018 17:52:57 +0000 (10:52 -0700)]
Update out-dir option for #5322.
Eric Huss [Sun, 8 Apr 2018 17:40:50 +0000 (10:40 -0700)]
Clarify -Z minimal-versions.
Eric Huss [Sat, 7 Apr 2018 21:11:07 +0000 (14:11 -0700)]
Add unstable documentation.
I kept most of these relatively brief with the intent that more complete
documentation would be added when a feature is stabilized. I did my best to be
accurate, but I am unfamiliar with most of these features, so please let me know
if anything should change.
@matklad: I didn't fully understand the use case for `minimal-versions`, so I
didn't say much about it. In particular, I didn't understand why one wouldn't
just use `~` or `=` semver requirements if you wanted to be careful about not
pulling in a newer version. When someone says "1.0", aren't they explicitly
saying they want a newer version (up to 2.0) if it's available? The example
in the RFC of switching a dependency to "=1.0" sounds like a breaking change
(essentially downgrading a dependency).
bors [Sun, 8 Apr 2018 17:11:32 +0000 (17:11 +0000)]
Auto merge of #5322 - matklad:correctly-use-unstable-options, r=alexcrichton
Properly use unstable options for out-dir
@alexcrichton how exactly are unstable CLI options supposed to be handled?
One can do `-Z unstable-options my-opt` (this is done for `registry`, and this pr uses the same approach for `out-dir`). Once can also do `-Z my-opt`. Doc comments say that `-Z my-opt=val` is also possible, but in reality it does not work.
This infra was inherited from `rustc`, which is a slightly different use-case, because it does not have subcommands. That is, if you do `-Z my-opt`, it is available for all subcommands, but does not show up in the help...
What do you think about having only `-Z unstable-options` to unlock all cli options? Or do we require a finer-graind granularity?
Somewhat related, we have a bunch of unstable options already... Do we have tracking issues for them, to know when the time comes to graduate them to stable?
Aleksey Kladov [Sun, 8 Apr 2018 15:28:27 +0000 (18:28 +0300)]
Document how to use Cargo's internal logging
bors [Sun, 8 Apr 2018 15:21:20 +0000 (15:21 +0000)]
Auto merge of #5319 - matklad:fix-profiler, r=Eh2406
Don't print profiling information twice
It's important to `.clear` the messages so that we don't print them
again for the next "profiling session". It might be argued that really
we should have a single "profiling session" for Cargo, but we don't at
the moment.
And, while we are at it, let's lock stdout as well, so that we won't
get confused when Cargo becomes multi-threaded and prints profiling info
from several threads simultaneously.
Aleksey Kladov [Sun, 8 Apr 2018 11:47:35 +0000 (14:47 +0300)]
Properly use unstable options for out-dir
Aleksey Kladov [Sun, 8 Apr 2018 08:37:05 +0000 (11:37 +0300)]
Don't print profiling information twice
It's important to `.clear` the messages so that we don't print them
again for the next "profiling session". It might be argued that really
we should have a single "profiling session" for Cargo, but we don't at
the moment.
And, while we are at it, let's lock stdout as well, so that we won't
get confused when Cargo becomes multi-threaded and prints profiling info
from several threads simultaneously.
bors [Sat, 7 Apr 2018 18:58:39 +0000 (18:58 +0000)]
Auto merge of #5317 - konstin:patch-1, r=matklad
Add link to the sources of the book
It's quite hard to find the folder with the sources of the book, so I added the link to the introduction.
konstin [Sat, 7 Apr 2018 18:42:33 +0000 (20:42 +0200)]
Add link to the sources of the book
It's quite hard to find the folder with the sources of the book, so I added the link to the introduction.
bors [Sat, 7 Apr 2018 16:44:28 +0000 (16:44 +0000)]
Auto merge of #5316 - matklad:profile-important-things, r=alexcrichton
Add profiling calls to stuff which is actually slow
So these two functions is what makes no-op build slow, so let's profile them to be able to track regressions better in the future.
Aleksey Kladov [Sat, 7 Apr 2018 15:43:23 +0000 (18:43 +0300)]
Add profiling calls to stuff which is actually slow
bors [Sat, 7 Apr 2018 14:30:47 +0000 (14:30 +0000)]
Auto merge of #5314 - matklad:need-more-time, r=alexcrichton
Try to measure all time it takes to compile code
As @killercup noticed on IRC, no-op build by Cargo takes as much as 300 ms (on stable, beta and nightly), which seems unreasonable. However, Cargo wrongly reports ` Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs`, and this might be the reason why we haven't noticed this before.
So let's try to measure time slightly better:
```
~/projects/rustraytracer master*
λ time cargo +stable build
Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
cargo +stable build 0.16s user 0.02s system 94% cpu 0.195 total
~/projects/rustraytracer master*
λ time $c build # Cargo with this patch applied
Finished dev [unoptimized + debuginfo] target(s) in 0.31 secs
$c build 0.30s user 0.02s system 96% cpu 0.330 total
```
r? @alexcrichton
Aleksey Kladov [Sat, 7 Apr 2018 14:12:14 +0000 (17:12 +0300)]
Try to measure all time it takes to compile code
bors [Fri, 6 Apr 2018 19:45:16 +0000 (19:45 +0000)]
Auto merge of #5307 - alexcrichton:another-fix, r=matklad
Fix another issue of poisoning too eagerly
This commit extends the fix in #5288 by moving the logic added farther up in the
loop over package dependencies. This means that we won't recursively look at
optional/dev path dependencies which aren't members of the workspace. This
should fix the new issue that came up in #5257
Closes #5257
Alex Crichton [Fri, 6 Apr 2018 19:35:37 +0000 (12:35 -0700)]
Fix another issue of poisoning too eagerly
This commit extends the fix in #5288 by moving the logic added farther up in the
loop over package dependencies. This means that we won't recursively look at
optional/dev path dependencies which aren't members of the workspace. This
should fix the new issue that came up in #5257
Closes #5257
bors [Fri, 6 Apr 2018 18:52:22 +0000 (18:52 +0000)]
Auto merge of #5302 - Eh2406:MoreRc, r=alexcrichton
use more Rc in the part of resolver that gets cloned a lot 2
This is the same idea as https://github.com/rust-lang/cargo/pull/5118, I was looking at a profile and noted that ~5% of our time was sent dropping `HashMap<PackageId, HashSet<InternedString>>`. A quick rg and I found the culprit, we are cloning the set of features for every new `Context`. With some Rc we are now just cloning for each time we insert.
To benchmark I commented out line https://github.com/rust-lang/cargo/blob/
b9aa315158fe4d8d63672a49200401922ef7385d/src/cargo/core/resolver/mod.rs#L453
the smallest change to get https://github.com/rust-lang/cargo/issues/4810#issuecomment-
357553286 not to solve instantly.
Before
17000000 ticks, 90s, 188.889 ticks/ms
After
17000000 ticks, 73s, 232.877 ticks/ms
Eh2406 [Fri, 6 Apr 2018 16:38:41 +0000 (12:38 -0400)]
use make_mut for cleaner code
Eh2406 [Thu, 5 Apr 2018 20:34:49 +0000 (16:34 -0400)]
use more Rc in the part of resolver that gets cloned a lot
bors [Thu, 5 Apr 2018 15:26:56 +0000 (15:26 +0000)]
Auto merge of #5299 - ehuss:rustdoc-edition, r=matklad
Pass edition to rustdoc.
Fixes #5279.
Eric Huss [Thu, 5 Apr 2018 13:42:48 +0000 (06:42 -0700)]
Unpin nightly version in CI.
Removes temporary workaround for rust-lang/rust#49033.
Eric Huss [Thu, 5 Apr 2018 13:04:45 +0000 (06:04 -0700)]
Don't use .arg() in test.
Eric Huss [Thu, 5 Apr 2018 12:39:50 +0000 (05:39 -0700)]
Pass edition to rustdoc.
Fixes #5279.
bors [Thu, 5 Apr 2018 09:22:15 +0000 (09:22 +0000)]
Auto merge of #5280 - klausi:clippy-191-trvials, r=matklad
chore(clippy): Simplify minor stuff found by clippy
Executed clippy 0.0.191, fixed the trivial stuff.
Filed https://github.com/rust-lang-nursery/rust-clippy/issues/2615 for all the format_err!() false positives.
bors [Thu, 5 Apr 2018 05:05:45 +0000 (05:05 +0000)]
Auto merge of #5294 - memoryleak47:typo, r=alexcrichton
fixed a few typos
I detected them using https://github.com/memoryleak47/typo.
memoryleak47 [Thu, 5 Apr 2018 01:45:15 +0000 (03:45 +0200)]
fixed a few typos
Klaus Purer [Wed, 4 Apr 2018 21:06:26 +0000 (23:06 +0200)]
chore(clippy): Fix test assertion and simplify code in crates-io
Klaus Purer [Tue, 3 Apr 2018 20:50:36 +0000 (22:50 +0200)]
chore(clippy): Simplify to Path.exists() and remove some more &
Klaus Purer [Mon, 2 Apr 2018 19:25:59 +0000 (21:25 +0200)]
chore(clippy): Simplify minor stuff found by clippy
bors [Wed, 4 Apr 2018 19:49:20 +0000 (19:49 +0000)]
Auto merge of #5293 - Eh2406:InternMoreStrings, r=alexcrichton
Intern more strings
As pointed out in https://github.com/rust-lang/cargo/pull/5270#issuecomment-
378372147, that clean up adds the mildly expensive `InternedString::new` to the hot path in the resolver.
The process of this PR is:
1. Find a `InternedString::new` in the hot path.
2. replace the argument of type `&str` that is passed along to `InternedString::new` with the type `InternedString`
3. add an `InternedString::new` to the callers until it type checked.
4. Repeat from step 1.
This stop if:
- It was traced back to something that was already an `InternedString`
- It was traced back to a `.to_string()` call
- It was in a persistent object creation
cc:
- @djc this is building on your work, I don't want to get in your way.
- @alexcrichton is this making things clearer and do you want to see a performance check?
Eh2406 [Wed, 4 Apr 2018 17:42:18 +0000 (13:42 -0400)]
Intern more strings
cargo +stable fmt
bors [Wed, 4 Apr 2018 18:58:15 +0000 (18:58 +0000)]
Auto merge of #5292 - djc:feature-requirements, r=alexcrichton
Revert serialization of features to string type
Accidentally broken during #5270 and only noticed after merge.
cc @matklad @Eh2406
Dirkjan Ochtman [Wed, 4 Apr 2018 18:07:57 +0000 (20:07 +0200)]
Revert serialization of features to string type
bors [Wed, 4 Apr 2018 16:28:33 +0000 (16:28 +0000)]
Auto merge of #5270 - djc:feature-requirements, r=Eh2406
Introduce FeatureValue type to represent features table values
This is the next step towards #1286 (after #5258). The goal here is to have a central place in the code where feature strings are interpreted as (a) a feature, (b) a dependency or (c) a dependency/feature combo, and anchor that interpretation in the type system as an enum.
I've spent quite a bit of effort avoiding extra string allocations, complicating the code a bit; notice in particular the use of `Cow<str>` in `FeatureValue` variants, and the slight workaround in `Context::resolve_features()` and `build_requirements()`. I hope this is all okay.
cc @Eh2406
Dirkjan Ochtman [Sat, 31 Mar 2018 15:34:19 +0000 (17:34 +0200)]
Extract function to build feature map for readability
Dirkjan Ochtman [Sun, 15 Oct 2017 12:23:33 +0000 (14:23 +0200)]
Introduce FeatureValue enum for tracking feature types
Dirkjan Ochtman [Sat, 14 Oct 2017 09:18:50 +0000 (11:18 +0200)]
Define FeatureMap type as an abstraction
bors [Wed, 4 Apr 2018 04:36:06 +0000 (04:36 +0000)]
Auto merge of #5290 - ehuss:lp-help, r=matklad
locate-project: Fix help description.
Eric Huss [Wed, 4 Apr 2018 04:03:10 +0000 (21:03 -0700)]
locate-project: Fix help description.
bors [Tue, 3 Apr 2018 23:41:50 +0000 (23:41 +0000)]
Auto merge of #5288 - alexcrichton:another-fix, r=matklad
Less aggressively poison sources on builds
Discovered in #5257 the changes in #5215 were slightly too aggressively
poisoning sources to require updates, thinking that a manifest changed when it
actually hadn't.
Non-workspace-member path dependencies with optional/dev-dependencies
don't show up in the lock file, so the previous logic would recognize this and
think that the dependency missing from the lock file was just added and would
require a registry update.
The fix in this commit effectively just skips all of these dependencies in
non-workspace members. This means that this will be slightly buggy if an
optional dependency that's activated is added, but that's hopefully something we
can tackle later.
Closes #5257
bors [Tue, 3 Apr 2018 22:50:12 +0000 (22:50 +0000)]
Auto merge of #5287 - matklad:safer-intern, r=Eh2406
Slightly improve InternedString
* Use `&'static str` instead of (ptr, len) pair to reduce unsafety.
* try make hash calculation O(1) instead of O(n), fail miserably,
document findings.
* Rename `to_inner` -> `as_str()`.
Alex Crichton [Tue, 3 Apr 2018 18:42:44 +0000 (11:42 -0700)]
Less aggressively poison sources on builds
Discovered in #5257 the changes in #5215 were slightly too aggressively
poisoning sources to require updates, thinking that a manifest changed when it
actually hadn't.
Non-workspace-member path dependencies with optional/dev-dependencies
don't show up in the lock file, so the previous logic would recognize this and
think that the dependency missing from the lock file was just added and would
require a registry update.
The fix in this commit effectively just skips all of these dependencies in
non-workspace members. This means that this will be slightly buggy if an
optional dependency that's activated is added, but that's hopefully something we
can tackle later.
Closes #5257
Aleksey Kladov [Tue, 3 Apr 2018 18:42:18 +0000 (21:42 +0300)]
Slightly improve InternedString
* Use `&'static str` instead of (ptr, len) pair to reduce unsafety.
* try make hash calculation O(1) instead of O(n), fail miserably,
document findings.
* Rename `to_inner` -> `as_str()`.
bors [Tue, 3 Apr 2018 18:52:50 +0000 (18:52 +0000)]
Auto merge of #5203 - matklad:out-dir, r=alexcrichton
cargo build --out-dir
This is intended to fix https://github.com/rust-lang/cargo/issues/4875. Very much work in progress, just to figure out how exactly `--out-dir` should work :)
The path of least resistance for implementing `out-dir` would be to just link everything from `target/debug` to the `out-dir`. However, the problem with this approach is that we link *too much* to the `target/debug`. For example, if you run `cargo build --bin foo`, you'll find not only the `foo` itself there, but also rlibs from the same workspace.
I think it's rather important not to copy extra stuff to out-dir, so it is implemented as a completely new parameter, which is threaded through various config structs and applies *only* to the top-level units (i.e, to the stuff user explicitly requested to compile on the command line).
I also plan to add platform specific tests here, to check that we get .pdb on windows and .dSYM on macs for various crate-types.
Because, in general, a single target may produce multiple files, `out-dir` has to be a directory, you can't directly specify the output *file*.
Note that artifacts are still generated to the `target` dir as well.
Also cc @nirbheek, I hope that this might be useful for Meson integration, because `--out-dir` should be more straightforward to use than `--message-format=json`.
The end result, for `cargo build --bin rustraytracer --out-dir out` on windows looks like this:

Note how we have fewer files in the `out` :)
r? @alexcrichton
Aleksey Kladov [Tue, 3 Apr 2018 15:23:02 +0000 (18:23 +0300)]
Fix tests for mac
bors [Tue, 3 Apr 2018 14:40:15 +0000 (14:40 +0000)]
Auto merge of #5285 - matklad:create-all-the-dirs, r=alexcrichton
Replace home-grown create_dir_all with std::fs::create_dir_all
The old one is just the historical artifact, right?
Aleksey Kladov [Tue, 3 Apr 2018 13:14:14 +0000 (16:14 +0300)]
Replace home-grown create_dir_all with std::fs::create_dir_all
Aleksey Kladov [Tue, 3 Apr 2018 13:06:56 +0000 (16:06 +0300)]
Test out-dir edge cases
Aleksey Kladov [Tue, 3 Apr 2018 12:43:45 +0000 (15:43 +0300)]
Feature gate `--out-dir`
Aleksey Kladov [Tue, 3 Apr 2018 06:51:52 +0000 (09:51 +0300)]
Implement `--out-dir` option
bors [Tue, 3 Apr 2018 08:19:41 +0000 (08:19 +0000)]
Auto merge of #5283 - matklad:better-assertion, r=matklad
Make assertion more informative
This assertion triggers when I try to build Cargo simultaneosly on
linux host and windows VM via a shared folder, but it's not clear
what is going on.
Aleksey Kladov [Tue, 3 Apr 2018 08:17:21 +0000 (11:17 +0300)]
Make assertion more informative
This assertion triggers when I try to build Cargo simultaneosly on
linux host and windows VM via a shared folder, but it's not clear
what is going on.
bors [Mon, 2 Apr 2018 21:50:59 +0000 (21:50 +0000)]
Auto merge of #5281 - matklad:cleanup, r=alexcrichton
Cleanup
Hopefully the last round of `conext` refactoring :-)
r? @alexcrichton