bors [Thu, 3 May 2018 18:19:51 +0000 (18:19 +0000)]
Auto merge of #5473 - ehuss:autobin-warning, r=alexcrichton
Address autobins warning.
Removes the large warning displayed if you build Cargo with itself (but adds a warning if you build with an older Cargo). Not sure which approach you prefer to address it, or if you want to do this later.
Eric Huss [Thu, 3 May 2018 16:13:36 +0000 (09:13 -0700)]
Address autobins warning.
bors [Thu, 3 May 2018 17:03:06 +0000 (17:03 +0000)]
Auto merge of #5470 - alexcrichton:hopeful-fix, r=matklad
Attmept to fix a spurious failure on AppVeyor
I *think* the issue is that `link.exe` is generating debuginfo in the background
which keeps the file open and prevents us from deleting it, but hopefully by
disabling debug information we'll either be able to confirm or deny this
hypothesis.
Alex Crichton [Thu, 3 May 2018 15:01:25 +0000 (08:01 -0700)]
Attmept to fix a spurious failure on AppVeyor
I *think* the issue is that `link.exe` is generating debuginfo in the background
which keeps the file open and prevents us from deleting it, but hopefully by
disabling debug information we'll either be able to confirm or deny this
hypothesis.
bors [Thu, 3 May 2018 15:31:44 +0000 (15:31 +0000)]
Auto merge of #5468 - matklad:aliases, r=alexcrichton
Tweak handling of aliases
Previously, `execute_subcommand` was called recursively, and each call
would `.configure` the `config` again. It worked, but seemed rather
fragile.
This commit handles aliases more explicitly, ensures that `.configure`
is called once and, as a bonus, adds a warning for when an alias is
shadowed by the built in.
Aleksey Kladov [Thu, 3 May 2018 11:05:21 +0000 (14:05 +0300)]
Tweak error messages
By convention, all errors should start with a lowercase letter
Aleksey Kladov [Thu, 3 May 2018 10:50:05 +0000 (13:50 +0300)]
Make alias handling more straightforward
Previously, `execute_subcommand` was called recursively, and each call
would `.configure` the `config` again. It worked, but seemed rather
fragile.
This commit handles aliases more explicitly, ensures that `.configure`
is called once and, as a bonus, adds a warning for when an alias is
shadowed by the built in.
bors [Thu, 3 May 2018 13:43:38 +0000 (13:43 +0000)]
Auto merge of #5464 - ehuss:restore-example-test, r=alexcrichton
Partially revert change to testing examples.
Fixes #5437
I don't think changing the behavior was quite the correct thing to do. This new behavior is very similar to the old with a few small differences:
```
cargo test
ORGINAL: Only builds examples.
NEW: Builds all examples. Any example with `test` set is tested.
cargo test --tests
ORIGINAL: Runs all examples as tests.
NEW: Only runs examples as tests if `test` is set.
cargo test --examples
ORIGINAL: Runs all examples as tests.
NEW: (SAME)
cargo test --example foo
ORIGINAL: Runs the given example as a test.
NEW: (SAME)
cargo test --all-targets
ORIGINAL: Runs all examples as tests.
NEW: (SAME)
```
bors [Thu, 3 May 2018 13:06:37 +0000 (13:06 +0000)]
Auto merge of #5469 - matklad:fix-link, r=matklad
Fix link in docs
Aleksey Kladov [Thu, 3 May 2018 13:06:18 +0000 (16:06 +0300)]
Fix link in docs
bors [Thu, 3 May 2018 10:26:59 +0000 (10:26 +0000)]
Auto merge of #5466 - matklad:pr-5465, r=matklad
Fix target_dir handling for RLS
Supersedes and closes #5465
Aleksey Kladov [Thu, 3 May 2018 10:22:03 +0000 (13:22 +0300)]
Fix the test
Nick Cameron [Thu, 3 May 2018 08:23:49 +0000 (20:23 +1200)]
Revert part to #5393
Commit
0b530c30867da26a4b59146f490c9f1d5377c20a (which this commit mostly reverts) did some refactoring around the `target_dir` function. However, it introduced a bug because it meant that where `CARGO_TARGET_DIR` was specified but `--target-dir` was not, the value from `CARGO_TARGET_DIR` was ignored.
Eric Huss [Thu, 3 May 2018 03:17:53 +0000 (20:17 -0700)]
Partially revert change to testing examples.
Fixes #5437
I don't think changing the behavior was quite the correct thing to do. This new behavior is very similar to the old with a few small differences:
```
cargo test
ORGINAL: Only builds examples.
NEW: Builds all examples. Any example with `test` set is tested.
cargo test --tests
ORIGINAL: Runs all examples as tests.
NEW: Only runs examples as tests if `test` is set.
cargo test --examples
ORIGINAL: Runs all examples as tests.
NEW: (SAME)
cargo test --example foo
ORIGINAL: Runs the given example as a test.
NEW: (SAME)
cargo test --all-targets
ORIGINAL: Runs all examples as tests.
NEW: (SAME)
```
bors [Wed, 2 May 2018 23:52:15 +0000 (23:52 +0000)]
Auto merge of #5462 - matklad:install-releases, r=alexcrichton
Don't install pre-releases by default
Currently, `cargo install` will try to install a pre-release version, if available (try `cargo install rand`). This happens because we use `VersionReq::any`, if no version is specified, and that matches pre-releases. The fix is to use `*`, which is different from `any`.
This needs to be done in `cargo install`, and not directly in `parse_no_deprecated`, the latter would be wrong, as demonstrated by a new test with patch.
Aleksey Kladov [Wed, 2 May 2018 22:26:48 +0000 (01:26 +0300)]
Don't install pre-releases by default
bors [Wed, 2 May 2018 19:03:17 +0000 (19:03 +0000)]
Auto merge of #5459 - matklad:more-comments, r=alexcrichton
Explain why we need a `Vec<Dependency>` in `Resolve`.
Looks like everyone, who sees it, asks the same question, so let's add an explanation!
cc https://github.com/rust-lang/cargo/pull/5428#issuecomment-
385459845
bors [Wed, 2 May 2018 17:17:27 +0000 (17:17 +0000)]
Auto merge of #5456 - LukasKalbertodt:patch-1, r=matklad
Show elapsed time in minutes if >= 60 secs
In large projects with long compile times, seeing "428.65 secs" isn't as clear to humans as seeing the number of minutes (and seconds).
**Old**:
```
Finished dev [unoptimized + debuginfo] target(s) in 2.23 secs
Finished dev [unoptimized + debuginfo] target(s) in 63.94 secs
Finished dev [unoptimized + debuginfo] target(s) in 428.65 secs
```
**New**:
```
Finished dev [unoptimized + debuginfo] target(s) in 2.23s
Finished dev [unoptimized + debuginfo] target(s) in 1m 3.94s
Finished dev [unoptimized + debuginfo] target(s) in 7m 8.65s
```
Note that I also changed `secs` to `s`, because `7 mins 8.65 secs` and `7m 8.65 secs` both look strange IMO. But if you disagree and you'd prefer `secs`, just tell me and I'll change it.
I *didn't* add a check for `secs >= 3600` to print the time in hours. I *hope* this is not necessary...
bors [Wed, 2 May 2018 16:35:38 +0000 (16:35 +0000)]
Auto merge of #5458 - alexcrichton:track-panic, r=matklad
Track panic mode in fingerprint
Ensure that if we've previously compiled a crate with panic=abort and we later
need it for panic=unwind we correctly recompile it.
Closes #5445
Lukas Kalbertodt [Wed, 2 May 2018 12:52:40 +0000 (14:52 +0200)]
Adjust tests to new time output format
Lukas Kalbertodt [Wed, 2 May 2018 10:15:37 +0000 (12:15 +0200)]
Show elapsed time in minutes if >= 60 secs
In large projects with long compile times, seeing "400.65 secs" isn't as
clear as seeing the number of minutes (and seconds).
bors [Wed, 2 May 2018 15:35:33 +0000 (15:35 +0000)]
Auto merge of #5454 - alexcrichton:fix, r=matklad
Fix optional dependencies and required dev-deps
This fixes an accidental bug introduced in #5300 by ensuring a local map keeps
track of the fact that there can be multiple dependencies for one name
Closes #5453
Aleksey Kladov [Wed, 2 May 2018 15:13:03 +0000 (18:13 +0300)]
Explain why we need a `Vec<Dependency>` in `Resolve`.
bors [Wed, 2 May 2018 14:40:15 +0000 (14:40 +0000)]
Auto merge of #5446 - csmoe:new_name, r=alexcrichton
Emit correct project name with --name
Fixes #5440
Alex Crichton [Wed, 2 May 2018 14:32:10 +0000 (07:32 -0700)]
Track panic mode in fingerprint
Ensure that if we've previously compiled a crate with panic=abort and we later
need it for panic=unwind we correctly recompile it.
Closes #5445
bors [Wed, 2 May 2018 14:15:23 +0000 (14:15 +0000)]
Auto merge of #5432 - djc:split-context, r=alexcrichton
Split Context into two types
@matklad here's the crazy attempt to make the `Context` situation slightly more sane. It basically splits all of the stuff that is immutable over the lifetime of the compilation from the stuff that's initialized empty. The latter is now stored in a type which I have provisionally called `BuildProgress` -- feel free to bikeshed about the name (I came up with `BuildData` as another alternative). It stores a reference to the `Context` to make things easier for now, we might want to change that down the line.
IMO this is a pretty good improvement, which clarifies the design quite a bit.
@alexcrichton you'll probably want to review this, too.
Dirkjan Ochtman [Sun, 29 Apr 2018 19:55:57 +0000 (21:55 +0200)]
Store unit dependencies directly into Context
Dirkjan Ochtman [Sun, 29 Apr 2018 19:45:35 +0000 (21:45 +0200)]
Move Links into context module
Dirkjan Ochtman [Sat, 28 Apr 2018 15:33:11 +0000 (17:33 +0200)]
Extract new build_context module out of context module
Dirkjan Ochtman [Sat, 28 Apr 2018 15:20:27 +0000 (17:20 +0200)]
Split Context into two types
Alex Crichton [Wed, 2 May 2018 00:03:23 +0000 (17:03 -0700)]
Fix optional dependencies and required dev-deps
This fixes an accidental bug introduced in #5300 by ensuring a local map keeps
track of the fact that there can be multiple dependencies for one name
Closes #5453
bors [Tue, 1 May 2018 18:32:06 +0000 (18:32 +0000)]
Auto merge of #5451 - DarkDrek:add_doc_clean, r=alexcrichton
Add cargo clean --doc
Implements #5449.
It only removes the doc directory and therefore keeps all other build artifacts intact.
When `--doc` is used all other options are ignored.
My test case is mostly copy&paste from `clean_release` so maybe the `.toml`s can be simplified.
DarkDrek [Tue, 1 May 2018 15:33:10 +0000 (17:33 +0200)]
Add cargo clean --doc
Dirkjan Ochtman [Sat, 14 Apr 2018 09:37:13 +0000 (11:37 +0200)]
Let Context store BuildConfig by reference
bors [Tue, 1 May 2018 13:50:13 +0000 (13:50 +0000)]
Auto merge of #5447 - ehuss:ws-error-message, r=alexcrichton
Better error message for `cargo rustc` in a workspace.
Fixes #5371
bors [Tue, 1 May 2018 03:49:32 +0000 (03:49 +0000)]
Auto merge of #5448 - ehuss:debug_env, r=alexcrichton
Fix "DEBUG" env var in build.rs for debug=0
Fixes #5370
Eric Huss [Tue, 1 May 2018 03:39:07 +0000 (20:39 -0700)]
Better error message for `cargo rustc` in a workspace.
Fixes #5371
csmoe [Tue, 1 May 2018 01:39:22 +0000 (09:39 +0800)]
add test for project name
csmoe [Tue, 1 May 2018 01:38:13 +0000 (09:38 +0800)]
fix project name
bors [Mon, 30 Apr 2018 18:19:47 +0000 (18:19 +0000)]
Auto merge of #5443 - rtsuk:update-doc-env-var, r=alexcrichton
Update documentation on config via environment variables
Use source replacement as a specific example of the kind
of configuration feature that cannot currently be set by
environmental variables.
bors [Mon, 30 Apr 2018 17:52:35 +0000 (17:52 +0000)]
Auto merge of #5300 - djc:namespaced-features, r=alexcrichton
Introduction of namespaced features (see #1286)
I think this basically covers all of the plans from #1286, although it still needs a bunch of tests and documentation updates. Submitting this PR to get some early feedback on the direction.
Eric Huss [Mon, 30 Apr 2018 17:17:43 +0000 (10:17 -0700)]
Fix "DEBUG" env var in build.rs for debug=0.
Fixes #5370
Rob Tsuk [Mon, 30 Apr 2018 15:49:27 +0000 (08:49 -0700)]
Update documentation on config via environment variables
Use source replacement as a specific example of the kind
of configuration feature that cannot currently be set by
environmental variables.
Dirkjan Ochtman [Mon, 30 Apr 2018 08:42:52 +0000 (10:42 +0200)]
Put namespaced features behind a feature gate
bors [Sat, 28 Apr 2018 18:02:36 +0000 (18:02 +0000)]
Auto merge of #5430 - matklad:bring-old-features-back, r=alexcrichton
Revert "Enable new behavior of `--feature`"
This reverts commit
038eec5cb3bd25a0855b0be6ad2aeba5391c6c6e.
As discussed at https://github.com/rust-lang/cargo/issues/5364, the new behavior unfortunately causes real-life breakage, so we have to revert it.
This is kinda sad, this is a part of the larger issue with feature selection, which, at the moment, has a behavior which I would classify (loosely speaking) as unsound:
* `cargo build -p foo` and `cargo build -p foo -p bar` might produce different artifacts for `foo` ([repro](https://github.com/matklad/workspace-vs-feaures))
* `cargo build -p foo` might produce different artifacts, depending on cwd ([repro](https://github.com/matklad/features-cwd))
The new feature behavior specifically addressed the second point.
It is unclear what we could do with this... One option, instead of flatly erroring out, as the revreted commit does, is to print a warning, but change the set of activated features. It will still be a breaking change, but it at least has a chance of working by accident.
r? @alexcrichton
bors [Sat, 28 Apr 2018 16:44:31 +0000 (16:44 +0000)]
Auto merge of #5425 - matklad:rename-fingerprint, r=alexcrichton
Package renames should affect fingerprints
bors [Sat, 28 Apr 2018 16:10:39 +0000 (16:10 +0000)]
Auto merge of #5428 - matklad:graph-with-edges, r=alexcrichton
Store dependencies as edges of the graph
r? @alexcrichton
bors [Sat, 28 Apr 2018 14:59:21 +0000 (14:59 +0000)]
Auto merge of #5429 - matklad:dashes-test, r=matklad
Extend dashes forwarding test
Closes https://github.com/rust-lang/cargo/issues/2213
Looks like this was fixed when we've transitioned to clap!
Aleksey Kladov [Sat, 28 Apr 2018 14:57:03 +0000 (17:57 +0300)]
Extend dashes forwarding test
Aleksey Kladov [Sat, 28 Apr 2018 14:28:39 +0000 (17:28 +0300)]
Revert "Enable new behavior of `--feature`"
This reverts commit
038eec5cb3bd25a0855b0be6ad2aeba5391c6c6e.
Aleksey Kladov [Sat, 28 Apr 2018 12:59:27 +0000 (15:59 +0300)]
Store dependencies as edges of the graph
Dirkjan Ochtman [Mon, 23 Apr 2018 07:18:08 +0000 (09:18 +0200)]
Add some documentation about unstable namespaced-features feature
Dirkjan Ochtman [Wed, 18 Apr 2018 10:12:43 +0000 (12:12 +0200)]
Add tests for namespaced features
Dirkjan Ochtman [Thu, 5 Apr 2018 14:59:51 +0000 (16:59 +0200)]
Take feature namespace into account while building summary (fixes #1286)
Here's an attempt at a table to cover the different cases:
Feature
Old (must be in features table)
Continue
Namespaced (might be stray value)
In features table: Check that Crate dependency is in the list
-> Non-optional dependency: Bail [PREVIOUSLY: bailed for non-optional dependency]
-> Optional dependency: Insert feature of this name
-> Else: Bail [PREVIOUSLY: bailed for unknown dependency or feature]
Crate
Old (might be stray value)
Non-optional dependency: Bail
No dependency found: Bail
Namespaced
Non-optional dependency: Bail
No dependency found: Bail
CrateFeature
Old
No dependency found: Bail
Namespaced
No dependency found: Bail
Dirkjan Ochtman [Mon, 2 Oct 2017 09:00:18 +0000 (11:00 +0200)]
Keep track of namespaced-features flag in Summary objects
For now, all Summaries from a registry have it set to false.
Dirkjan Ochtman [Mon, 2 Oct 2017 07:30:22 +0000 (09:30 +0200)]
Add namespaced-features option for manifest [project] section
Dirkjan Ochtman [Thu, 5 Apr 2018 14:23:11 +0000 (16:23 +0200)]
Make a dependencies map while building feature map
Dirkjan Ochtman [Thu, 5 Apr 2018 13:22:37 +0000 (15:22 +0200)]
Simplify retrieval of dependency data
Aleksey Kladov [Sat, 28 Apr 2018 10:35:49 +0000 (13:35 +0300)]
Mix package renames into fingerprints
bors [Fri, 27 Apr 2018 23:22:50 +0000 (23:22 +0000)]
Auto merge of #5384 - ehuss:profile-override, r=matklad
Profile Overrides (RFC #2282 Part 1)
Profile Overrides (RFC #2282 Part 1)
WIP: Putting this up before I dig into writing tests, but should be mostly complete. I also have a variety of questions below.
This implements the ability to override profiles for dependencies and build scripts. This includes a general rework of how profiles work internally. Closes #5298.
Profile overrides are available with `profile-overrides` set in `cargo-features` in the manifest.
Part 2 is to implement profiles in config files (to be in a separate PR).
General overview of changes:
- `Profiles` moved to `core/profiles.rs`. All profile selection is centralized there.
- Removed Profile flags `test`, `doc`, `run_custom_build`, and `check`.
- Removed `Profile` from `Unit` and replaced it with two enums: `CompileMode` and `ProfileFor`. This is the minimum information needed to compute profiles at a later stage.
- Also removed `rustc_args`/`rustdoc_args` from `Profile` and place them in `Context`. This is currently not very elegant because it is a special case, but it works. An alternate solution I considered was to leave them in the `Profile` and add a special uber-override layer. Let me know if you think it should change.
- Did some general cleanup in `generate_targets`.
## Misc Fixes
- `cargo check` now honors the `--release` flag. Fixes #5218.
- `cargo build --test` will set `panic` correctly for dependences. Fixes #5369.
- `cargo check --tests` will no longer include bins twice (once as a normal check, once as a `--test` check). It only does `--test` check now.
- Similarly, `cargo check --test name` no longer implicitly checks bins.
- Examples are no longer considered a "test". (See #5397). Consequences:
- `cargo test` will continue to build examples as a regular build (no change).
- `cargo test --tests` will no longer build examples at all.
- `cargo test --all-targets` will no longer build examples as tests, but instead build them as a regular build (now matches `cargo test` behavior).
- `cargo check --all-targets` will no longer check examples twice (once as
normal, once as `--test`). It now only checks it once as a normal
target.
## Questions
- Thumbs up/down on the general approach?
- The method to detect if a package is a member of a workspace should probably be redone. I'm uncertain of the best approach. Maybe `Workspace.members` could be a set?
- `Hash` and `PartialEq` are implemented manually for `Profile` only to avoid matching on the `name` field. The `name` field is only there for debug purposes. Is it worth it to keep `name`? Maybe useful for future use (like #4140)?
- I'm unhappy with the `Finished` line summary that displays `[unoptimized + debuginfo]`. It doesn't actually show what was compiled. Currently it just picks the base "dev" or "release" profile. I'm not sure what a good solution is (to be accurate it would need to potentially display a list of different options). Is it ok? (See also #4140 for the wrong profile name being printed.)
- Build-dependencies use different profiles based on whether or not `--release` flag is given. This means that if you want build-dependencies to always use a specific set of settings, you have to specify both `[profile.dev.build_override]` and `[profile.release.build_override]`. Is that reasonable (for now)? I've noticed some issues (like #1774, #2234, #2424) discussing having more control over how build-dependencies are handled.
- `build --bench xxx` or `--benches` builds dependencies with dev profile, which may be surprising. `--release` does the correct thing. Perhaps print a warning when using `cargo build` that builds benchmark deps in dev mode?
- Should it warn/error if you have an override for a package that does not exist?
- Should it warn/error if you attempt to set `panic` on the `test` or `bench` profile?
## TODO
- I have a long list of tests to add.
- Address a few "TODO" comments left behind.
Eric Huss [Fri, 27 Apr 2018 18:23:57 +0000 (11:23 -0700)]
Minor style update.
Eric Huss [Tue, 24 Apr 2018 17:35:20 +0000 (10:35 -0700)]
Comment why `deps_of` doesn't need to keep track of `profile_for` in map.
Eric Huss [Tue, 24 Apr 2018 17:12:53 +0000 (10:12 -0700)]
Fix Unit/Context parameter order.
Eric Huss [Sun, 22 Apr 2018 20:57:38 +0000 (13:57 -0700)]
Avoid building libs and bins twice in `cargo build --all-targets --release`.
This changes it so that `Build` mode is not set in the Unit, since there is
no difference between Bench and Test once the profile has been selected.
Eric Huss [Sun, 22 Apr 2018 16:05:18 +0000 (09:05 -0700)]
Update tests now that `cargo check` does not re-check bins.
Eric Huss [Sun, 22 Apr 2018 00:21:42 +0000 (17:21 -0700)]
Add some more tests.
Eric Huss [Sat, 21 Apr 2018 20:57:54 +0000 (13:57 -0700)]
Add thorough tests for target/profile selection.
Eric Huss [Sat, 21 Apr 2018 20:47:01 +0000 (13:47 -0700)]
Move profile override tests to a dedicated file.
Eric Huss [Sat, 21 Apr 2018 19:16:03 +0000 (12:16 -0700)]
rustfmt
Eric Huss [Sat, 21 Apr 2018 18:18:05 +0000 (11:18 -0700)]
Remove last TODO comments.
Eric Huss [Sat, 21 Apr 2018 17:41:05 +0000 (10:41 -0700)]
Some test cleanup for profiles.
Eric Huss [Sat, 21 Apr 2018 17:03:23 +0000 (10:03 -0700)]
Add more profile override validation tests.
Eric Huss [Sat, 21 Apr 2018 16:50:55 +0000 (09:50 -0700)]
Add test for profile override on non-dev/release.
Eric Huss [Sat, 21 Apr 2018 16:40:00 +0000 (09:40 -0700)]
Add warning if `panic` is set in test or bench profile.
Eric Huss [Sat, 21 Apr 2018 05:19:16 +0000 (22:19 -0700)]
Add warnings for unknown profile overrides.
Eric Huss [Sat, 21 Apr 2018 02:43:57 +0000 (19:43 -0700)]
Minor tweaks on how examples are handled with tests, and some panic propagation.
Eric Huss [Fri, 20 Apr 2018 20:20:38 +0000 (13:20 -0700)]
Avoid running `build.rs` too often.
Eric Huss [Thu, 19 Apr 2018 02:54:01 +0000 (19:54 -0700)]
Add extra rustc/rustdoc args to the fingerprint and metadata.
Eric Huss [Thu, 19 Apr 2018 02:17:38 +0000 (19:17 -0700)]
Update for some review comments.
Eric Huss [Thu, 19 Apr 2018 00:21:03 +0000 (17:21 -0700)]
Fix a variety of profile bugs.
Eric Huss [Wed, 18 Apr 2018 18:41:58 +0000 (11:41 -0700)]
Move `Profile` back into `Unit` as a copy.
The de-duplication of Units just doesn't work without it.
Eric Huss [Wed, 18 Apr 2018 14:03:17 +0000 (07:03 -0700)]
Minor cleanup.
Eric Huss [Wed, 18 Apr 2018 01:46:44 +0000 (18:46 -0700)]
Profile Overrides (RFC #2282 Part 1)
bors [Fri, 27 Apr 2018 17:48:52 +0000 (17:48 +0000)]
Auto merge of #5415 - alexcrichton:rename-same-dep, r=matklad
Fix renaming crates as they come from 2 sources
Previously there was a verification in manifest parsing that the same dependency
must come from the same source, but this erroneously triggered an error to get
emitted when the `package` key was used to rename crates. The first change here
was to update that clause to key off the `rename` field rather than the `name`
field.
Afterwards, though, this exposed an existing bug in the implementation. During
compilation we have a `Resolve` which is a graph of crates, but we don't know
*why* each edge in the dependency graph exists. In other words we don't know,
when looking at an edge of the graph, what `Dependency` caused that edge to be
drawn. We need to know this when passing `--extern` flags because the
`Dependency` is what lists what's being renamed.
This commit then primarily refactors `Resolve::deps` from an iterator of package
ids to an iterator of a tuples. The first element is the package id from before
and the second element is a list of `Dependency` directives which caused the
edge to ber driven.
This refactoring cleaned up a few places in the backend where we had to work
around the lack of this knowledge. Namely this also fixes the extra test added
here.
Closes #5413
Alex Crichton [Wed, 25 Apr 2018 17:41:33 +0000 (10:41 -0700)]
Fix renaming crates as they come from 2 sources
Previously there was a verification in manifest parsing that the same dependency
must come from the same source, but this erroneously triggered an error to get
emitted when the `package` key was used to rename crates. The first change here
was to update that clause to key off the `rename` field rather than the `name`
field.
Afterwards, though, this exposed an existing bug in the implementation. During
compilation we have a `Resolve` which is a graph of crates, but we don't know
*why* each edge in the dependency graph exists. In other words we don't know,
when looking at an edge of the graph, what `Dependency` caused that edge to be
drawn. We need to know this when passing `--extern` flags because the
`Dependency` is what lists what's being renamed.
This commit then primarily refactors `Resolve::deps` from an iterator of package
ids to an iterator of a tuples. The first element is the package id from before
and the second element is a list of `Dependency` directives which caused the
edge to ber driven.
This refactoring cleaned up a few places in the backend where we had to work
around the lack of this knowledge. Namely this also fixes the extra test added
here.
Closes #5413
bors [Fri, 27 Apr 2018 15:36:16 +0000 (15:36 +0000)]
Auto merge of #5349 - bmwill:fetch-by-target, r=alexcrichton
cargo-fetch: add option to fetch for a target
Teach cargo-fetch how to optionally fetch dependencies based on a target
platform by specifying the target triple via `--target <TRIPLE>`.
#5216
bors [Fri, 27 Apr 2018 15:14:03 +0000 (15:14 +0000)]
Auto merge of #5410 - klnusbaum:edition_5406, r=matklad
switch to using the --edition flag
Now that we have an `--edition` flag in the rust compiler, let's switch to using it.
fixes #5406
Brandon Williams [Mon, 9 Apr 2018 18:31:04 +0000 (11:31 -0700)]
cargo-fetch: add option to fetch for a target
Teach cargo-fetch how to optionally fetch dependencies based on a target
platform by specifying the target triple via `--target <TRIPLE>`.
Signed-off-by: Brandon Williams <bmwill@google.com>
bors [Tue, 24 Apr 2018 14:36:52 +0000 (14:36 +0000)]
Auto merge of #5394 - henriklaxhuber:master, r=alexcrichton
Pass linker path to build script
This change adds the environment variable LINKER to pass the path of the linker used by cargo to the build script. This complements the variable RUSTC (the rustc binary used) to give the build script full knowledge of its environment.
A specific usage example would be automatically generating bindings to system headers in cross compilation, e.g. by locating jni.h for android targets.
bors [Tue, 24 Apr 2018 14:12:10 +0000 (14:12 +0000)]
Auto merge of #5393 - smithsps:master, r=matklad
Add target directory parameter --target-dir
Implements: https://github.com/rust-lang/cargo/issues/5308
Adds a target directory parameter, that acts in the same manner as the environment variable `CARGO_TARGET_DIR`, to the following subcommands:
- `bench`
- `build`
- `check`
- `clean`
- `doc`
- `package`
- `publish`
- `run`
- `rustc`
- `rustdoc`
- `test`
bors [Tue, 24 Apr 2018 09:07:18 +0000 (09:07 +0000)]
Auto merge of #5398 - dwijnand:drop-legacy-paths, r=matklad
Drop legacy path support under Rust edition 2018 (or later)
builds on #5335
submitted for early feedback: wdyt @matklad? is this what you had in mind? what should change? what should be added? how should we test this? is the current (2015) messaging enough to drop it in 2018?
r? @matklad
<!--{"baseBranch":"rust-lang:cargo:target-autodiscovery"}-->
Simon Smith [Tue, 24 Apr 2018 06:15:55 +0000 (02:15 -0400)]
Add target directory parameter: address suggestions
Henrik Laxhuber [Tue, 24 Apr 2018 06:18:33 +0000 (08:18 +0200)]
Moved RUSTC_LINKER test into its own fn
Simon Smith [Mon, 16 Apr 2018 23:50:30 +0000 (19:50 -0400)]
Add target directory parameter --target-dir
Henrik Laxhuber [Mon, 23 Apr 2018 16:28:38 +0000 (18:28 +0200)]
Fixed RUSTC_LINKER test for Windows hosts
Henrik Laxhuber [Mon, 23 Apr 2018 15:45:17 +0000 (17:45 +0200)]
Fixed build script env var test
Henrik Laxhuber [Mon, 23 Apr 2018 15:11:10 +0000 (17:11 +0200)]
Added tests for RUSTC_LINKER buils script env var
Added tests for the environment variable RUSTC_LINKER that is
passed to the build script.
Also slightly improved readability of the code responsible for
passing the env var.
Kurtis Nusbaum [Sun, 22 Apr 2018 19:14:21 +0000 (12:14 -0700)]
switch to using the --edition flag
bors [Sun, 22 Apr 2018 19:11:37 +0000 (19:11 +0000)]
Auto merge of #5407 - klausi:fixed-minimal-versions, r=matklad
fix(dependendies): Bump minimal dependency versions so that cargo successfully builds with those
Spin-off from #5275 .
Just bump the minimum dependency versions here, we are developing CI testing in #5275 .
Klaus Purer [Sun, 22 Apr 2018 18:55:53 +0000 (20:55 +0200)]
fix(dependendies): Bump minimal dependency versions so that cargo successfully builds with those