Commit graph

1139 commits

Author SHA1 Message Date
Eric Huss a59ea45c1a Fix documenting an example. 2019-06-08 14:18:51 -07:00
Eric Huss a8c22ca1e8 Update to allow publishing cargo-test-macro. 2019-06-07 13:22:10 -07:00
Eric Huss 1e74ea8578 Update reamp_path_prefix_ignored to cargo_test. 2019-06-07 12:51:56 -07:00
Jethro Beekman 0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Jethro Beekman a598309cb6 Don't rely on a thread local to uniquely create test roots 2019-06-07 12:41:25 -07:00
Jethro Beekman e157b6d84c Fix intermittent test failure due to interleaved stdout 2019-06-07 12:41:25 -07:00
Jethro Beekman 04a9a7cc34 Fix tests when running with RUST_TEST_THREADS=1 2019-06-07 12:41:25 -07:00
bors e30ab5e7cc Auto merge of #7018 - cuviper:libgit2-0.28, r=alexcrichton
Update git2 crates for libgit2 0.28

See https://github.com/rust-lang/git2-rs/pull/425
2019-06-07 18:03:21 +00:00
Alex Crichton c35c90028e Make git auth script Windows/bash compatible 2019-06-07 10:24:15 -07:00
Matthias Krüger 64ae32774a fix a bunch of clippy warnings
Fixes:

clippy::into_iter_on_ref
clippy::needless_borrow
clippy::useless_format
clippy::renamed_and_removed_lints
clippy::clone_on_copy
clippy::or_fun_call
clippy::redundant_clone
2019-06-07 13:20:26 +02:00
bors 65e3885ce3 Auto merge of #6966 - ehuss:reamp-path-prefix-hash, r=@alexcrichton
Ignore remap-path-prefix in metadata hash.

Including this flag in the metadata hash causes problems with reproducible builds.

I spent some time considering the different alternatives (such as providing a config option, or an unhashed RUSTFLAGS alternative), and decided this might be the best option.

- It is a very simple, small change.
- It should be safe.
- It is transparent to the user, they don't need to do anything special.
- It doesn't expand Cargo's interface.

Fixes #6914.
2019-06-06 21:17:48 +00:00
Alex Crichton dbc2c2b57d Don't synthesize feature diretives for non-optional deps
Currently when Cargo is invoked on the command like `cargo build
--features foo/bar` then it will actually always compile the current
crate with `feature = "foo"` even if `foo` is a non-optional dependency.
This isn't intended because the crate doesn't actually have a `foo`
feature as so no directive should be emitted or passed to the compiler.

This was discovered in rust-lang/rust where Cargo is being built with
the `rustc-workspace-hack` feature but when the RLS depends on Cargo it
doesn't enable the same feature. This feature, however, doesn't actually
exist for Cargo!
2019-06-05 09:10:10 -07:00
bors 0e38712d4d Auto merge of #6869 - alexcrichton:vendor, r=ehuss
Import the cargo-vendor subcommand into Cargo

This commit imports the external [alexcrichton/cargo-vendor
repository][repo] into Cargo itself. This means it will no longer be
necessary to install the `cargo-vendor` subcommand in order to vendor
dependencies. Additionally it'll always support the latest feature set
of Cargo as it'll be built into Cargo!

All tests were imported as part of this commit, but not all features
were imported. Some flags have been left out that were added later in
the lifetime of `cargo vendor` which seem like they're more questionable
to stabilize. I'm hoping that they can have separate PRs adding their
implementation here, and we can make a decision of their stabilization
at a later date.

The current man page for `cargo vendor -h` will look like:

    cargo-vendor
    Vendor all dependencies for a project locally

    USAGE:
	cargo vendor [OPTIONS] [--] [path]

    OPTIONS:
	-q, --quiet                    No output printed to stdout
	    --manifest-path <PATH>     Path to Cargo.toml
	    --no-delete                Don't delete older crates in the vendor directory
	-s, --sync <TOML>...           Additional `Cargo.toml` to sync and vendor
	    --respect-source-config    Respect `[source]` config in `.cargo/config`
	-v, --verbose                  Use verbose output (-vv very verbose/build.rs output)
	    --color <WHEN>             Coloring: auto, always, never
	    --frozen                   Require Cargo.lock and cache are up to date
	    --locked                   Require Cargo.lock is up to date
	-Z <FLAG>...                   Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
	-h, --help                     Prints help information

    ARGS:
	<path>    Where to vendor crates (`vendor` by default)

    This cargo subcommand will vendor all crates.io and git dependencies for a
    project into the specified directory at `<path>`. After this command completes
    the vendor directory specified by `<path>` will contain all remote sources from
    dependencies specified. Additionally manifest beyond the default one can be
    specified with the `-s` option.

    The `cargo vendor` command will also print out the configuration necessary
    to use the vendored sources, which when needed is then encoded into
    `.cargo/config`.

Since this change is not importing 100% of the functionality of the
existing `cargo vendor` this change does run a risk of being a breaking
change for any folks using such functionality. Executing `cargo vendor`
will favor the built-in command rather than an external subcommand,
causing unimplemented features to become errors about flag usage.

[repo]: https://github.com/alexcrichton/cargo-vendor
2019-06-03 17:03:44 +00:00
Eric Huss 69091780d1 Catch filename output collisions in rustdoc. 2019-05-31 12:06:07 -07:00
Eh2406 3052e59c91 Revert most of #84586611 to get test to pass 2019-05-30 10:05:54 -04:00
Eh2406 9d86b82824 The topological sort in the SAT solver was messed up by a refactor 2019-05-29 14:18:08 -04:00
bors a7648c7542 Auto merge of #6980 - Eh2406:varisat, r=alexcrichton
Test the Resolver against the varisat Library

Resolution can be reduced to the SAT problem. So this is an alternative implementation of the resolver that uses a SAT library for the hard work. This is intended to be easy to read, as compared to the real resolver, and run as part of the test sweet to make sure the real resolver works as expected. Part of #6120.

Some notes on performance:
The initial version did not support public & private deps:
~64 loc, `O(nln(n))` vars, `O(nln(n) + n*d)` clauses, 0.5x slower on `prop_passes_validation`
The final version:
~163 loc, `O(dn^2`) vars, `O(dn^3)`  clauses, 1.5x slower on `prop_passes_validation`

That comparison makes me feel better about spending months trying to get public & private deps to be fast enough for stabilization.
2019-05-28 15:13:28 +00:00
Eh2406 e08d032482 add a helper function 2019-05-24 12:09:15 -04:00
Eh2406 84586611af reuse vars where publicly_exports implies can_see 2019-05-24 10:45:38 -04:00
Eh2406 a7676ebc39 remove a redundant clause 2019-05-23 18:04:42 -04:00
Eh2406 514039eda0 make sure the complicated cases are at the end 2019-05-23 16:58:29 -04:00
Eh2406 5143c0cab3 Work around accidentally quadratic debug_assert in varisat 2019-05-23 14:15:09 -04:00
bors 7a7d2aaa88 Auto merge of #6973 - exphp-forks:check-directory, r=ehuss
cargo package: detect new empty directories

Detect the creation of directories in a build script, which is currently a very tempting workaround for the fact that a crate built from a package will be missing any empty directories.

Maybe it would be better to only include directories in the map of hashes if they are completely empty.

The removal of a directory that is initially empty cannot be tested because, as stated above, a crate built from a package will not *have* any empty directories.

Closes #6931.
2019-05-23 17:08:40 +00:00
Eh2406 c68334ff4a Think of publicly_exports as being in terms of a set of activations_keys 2019-05-22 14:52:02 -04:00
Eh2406 a25d8e9e96 use a topological_order to only make a var where needed 2019-05-22 12:02:01 -04:00
Eh2406 6454efdd67 support public & private deps 2019-05-22 09:28:58 -04:00
Eh2406 c7e23ae20f maintain almost the same interface 2019-05-21 12:58:05 -04:00
Eh2406 3c87b4026e amortize constructing the SAT solver 2019-05-21 12:11:26 -04:00
Eh2406 52cf0f733e use a better encoding 2019-05-21 12:11:25 -04:00
Eh2406 f8008a46cf make n smaller in the O(n^2) parts 2019-05-21 12:11:25 -04:00
Eh2406 9602b78cc7 use varisat to verify the resolver 2019-05-21 12:11:25 -04:00
Alex Crichton 3842d8e6f2 Import the cargo-vendor subcommand into Cargo
This commit imports the external [alexcrichton/cargo-vendor
repository][repo] into Cargo itself. This means it will no longer be
necessary to install the `cargo-vendor` subcommand in order to vendor
dependencies. Additionally it'll always support the latest feature set
of Cargo as it'll be built into Cargo!

All tests were imported as part of this commit, but not all features
were imported. Some flags have been left out that were added later in
the lifetime of `cargo vendor` which seem like they're more questionable
to stabilize. I'm hoping that they can have separate PRs adding their
implementation here, and we can make a decision of their stabilization
at a later date.

The current man page for `cargo vendor -h` will look like:

    cargo-vendor
    Vendor all dependencies for a project locally

    USAGE:
	cargo vendor [OPTIONS] [--] [path]

    OPTIONS:
	-q, --quiet                    No output printed to stdout
	    --manifest-path <PATH>     Path to Cargo.toml
	    --no-delete                Don't delete older crates in the vendor directory
	-s, --sync <TOML>...           Additional `Cargo.toml` to sync and vendor
	    --respect-source-config    Respect `[source]` config in `.cargo/config`
	-v, --verbose                  Use verbose output (-vv very verbose/build.rs output)
	    --color <WHEN>             Coloring: auto, always, never
	    --frozen                   Require Cargo.lock and cache are up to date
	    --locked                   Require Cargo.lock is up to date
	-Z <FLAG>...                   Unstable (nightly-only) flags to Cargo, see 'cargo -Z help' for details
	-h, --help                     Prints help information

    ARGS:
	<path>    Where to vendor crates (`vendor` by default)

    This cargo subcommand will vendor all crates.io and git dependencies for a
    project into the specified directory at `<path>`. After this command completes
    the vendor directory specified by `<path>` will contain all remote sources from
    dependencies specified. Additionally manifest beyond the default one can be
    specified with the `-s` option.

    The `cargo vendor` command will also print out the configuration necessary
    to use the vendored sources, which when needed is then encoded into
    `.cargo/config`.

Since this change is not importing 100% of the functionality of the
existing `cargo vendor` this change does run a risk of being a breaking
change for any folks using such functionality. Executing `cargo vendor`
will favor the built-in command rather than an external subcommand,
causing unimplemented features to become errors about flag usage.

[repo]: https://github.com/alexcrichton/cargo-vendor
2019-05-21 07:02:17 -07:00
Michael Lamparski aef2a9cbc4 cargo package: detect new empty directories 2019-05-20 21:11:34 -04:00
Eric Huss f6d30e9155 Cache-messages: address some review comments.
- Add some comments and cleanup.
- Error out when using `short`.
2019-05-20 15:22:32 -07:00
Eric Huss dcd4999d42 Add message caching. 2019-05-20 15:22:32 -07:00
bors 719781be1a Auto merge of #6971 - ehuss:finished-0-debug, r=alexcrichton
Set `Finished` line correctly for debug=0.

Don't say `+ debuginfo` if `debug = 0`.

Fixes #6948
2019-05-20 21:47:26 +00:00
bors 13e43aab29 Auto merge of #6970 - ehuss:clippy-fixes, r=Eh2406
Clippy fixes

Some of these are arguably not strictly better, but didn't really seem worse to me either.

I tried changing all `&Unit` to `Unit`, but I felt like the code was worse with more frequent use of `*` and `&`.
2019-05-20 20:58:14 +00:00
Eric Huss a03ae27187 Set Finished line correctly for debug=0. 2019-05-20 13:50:27 -07:00
Eric Huss 6b07c8da63 cargo fmt 2019-05-20 12:40:20 -07:00
Eric Huss ec21e12d8a Some clippy fixes. 2019-05-20 12:40:14 -07:00
Eh2406 a02f6a12f8 add pub-piv prop tests.
This was supposed to be in #6653, but was lost in the edits of history.
Reconstructed from 5522aba5e8
2019-05-20 11:31:04 -04:00
Eric Huss c8a9f88f09 Ignore remap-path-prefix in metadata hash. 2019-05-20 07:44:41 -07:00
vlad20012 e1d433d30f Add doctest field into metadata
Some tools can support rust doctests (e.g. highlighting
or launching). So it should be possible to find out if
doctests are enabled for a target or not. This commit
adds `doctest` field to `cargo metadata` output.
2019-05-17 18:39:23 +03:00
Matthias Krüger 235fcbecc2 tests: registry: revert readonly permission after running tests.
Fixes #6943
2019-05-15 20:16:37 +02:00
bors 1b4fab3263 Auto merge of #6904 - fluffysquirrels:first-update-precise, r=alexcrichton
Fix for "Running cargo update without a Cargo.lock ignores arguments" #6872
2019-05-15 14:53:37 +00:00
Alex Crichton 5d9383ed76 Re-enable compatibility with readonly CARGO_HOME
Previously Cargo would attempt to work as much as possible with a
previously filled out CARGO_HOME, even if it was mounted as read-only.
In #6880 this was regressed as a few global locks and files were always
attempted to be opened in writable mode.

This commit fixes these issues by correcting two locations:

* First the global package cache lock has error handling to allow
  acquiring the lock in read-only mode inaddition to read/write mode. If
  the read/write mode failed due to an error that looks like a readonly
  filesystem then we assume everything in the package cache is readonly
  and we switch to just acquiring any lock, this time a shared readonly
  one. We in theory aren't actually doing any synchronization at that
  point since it's all readonly anyway.

* Next when unpacking package we're careful to issue a `stat` call
  before opening a file in writable mode. This way our preexisting guard
  to return early if a package is unpacked will succeed before we open
  anything in writable mode.

Closes #6928
2019-05-14 07:46:01 -07:00
Eric Huss 337fbaaa12 Fix version of ignore.
Some tests relied on new behavior, so bump the minimal version.

The change to `gitignore_negate` was just an innocuous typo.
2019-05-13 18:05:10 -07:00
Eric Huss 309eb874fd Stabilize offline mode. 2019-05-12 10:49:45 -07:00
Alex Helfet 36160ed444 Merge remote-tracking branch 'origin/master' into first-update-precise 2019-05-11 16:44:39 +01:00
bors ceb1389037 Auto merge of #6924 - ehuss:include-exclude-patterns, r=alexcrichton
Migrate package include/exclude to gitignore patterns.

This moves to the next phase of #4268.

This also includes a fdew more changes which can be removed if desired:
- Add support for `!` negate gitignore patterns.
- Add a warning if both package.include and package.exclude are specified.
2019-05-10 15:03:12 +00:00
Eric Huss db3328ecb1 Add a warning if both package.include and package.exclude are specified. 2019-05-10 07:46:50 -07:00
Eric Huss 3ca96e90eb Add support for ! negate gitignore patterns. 2019-05-10 07:46:50 -07:00
Eric Huss d4b6e90fc1 Migrate package include/exclude to gitignore patterns. 2019-05-10 07:46:50 -07:00
bors 2e09266f66 Auto merge of #6883 - alexcrichton:pipelining-v2, r=ehuss
Implement the Cargo half of pipelined compilation (take 2)

This commit starts to lay the groundwork for #6660 where Cargo will
invoke rustc in a "pipelined" fashion. The goal here is to execute one
command to produce both an `*.rmeta` file as well as an `*.rlib` file
for candidate compilations. In that case if another rlib depends on that
compilation, then it can start as soon as the `*.rmeta` is ready and not
have to wait for the `*.rlib` compilation.

Initially attempted in #6864 with a pretty invasive refactoring this
iteration is much more lightweight and fits much more cleanly into
Cargo's backend. The approach taken here is to update the
`DependencyQueue` structure to carry a piece of data on each dependency
edge. This edge information represents the artifact that one node
requires from another, and then we a node has no outgoing edges it's
ready to build.

A dependency on a metadata file is modeled as just that, a dependency on
just the metadata and not the full build itself. Most of cargo's backend
doesn't really need to know about this edge information so it's
basically just calculated as we insert nodes into the `DependencyQueue`.
Once that's all in place it's just a few pieces here and there to
identify compilations that *can* be pipelined and then they're wired up
to depend on the rmeta file instead of the rlib file.

Closes #6660
2019-05-10 14:36:30 +00:00
bors 29b000fcc2 Auto merge of #6925 - ehuss:package-include-manifest, r=alexcrichton
Always include `Cargo.toml` when packaging.

Since `Cargo.toml` is required, might as well include it automatically rather than force everyone to include it explicitly. If it is not listed in `include`, there was a somewhat confusing error message when packaging.

Closes #6830
Closes #4660
2019-05-10 13:44:03 +00:00
Eric Huss 49e37f80fa Always include Cargo.toml when packaging. 2019-05-09 13:34:08 -07:00
Eric Huss 87449f453b Remove unnecessary calls to masquerade_as_nightly_cargo.
These are not needed anymore.
2019-05-09 10:58:18 -07:00
Alex Crichton 6b28a0c050 Fix fingerprint handling in pipelining mode
This commit fixes an issue when pipelining mode is used in handling
recompilations. Previously a sequence of compilations could look like:

* Crate A starts to build
* Crate A produces metadata
* Crate B, which depends on A, starts
* Crate B finishes
* Crate A finishes

In this case the mtime for B is before that of A, which fooled Cargo
into thinking that B needed to be recompiled. In this case, however, B
doesn't actually need to be recompiled because it only depends on the
metadata of A, not the final artifacts.

This unfortunately resulted in some duplication in a few places, but not
really much moreso than already exists between fingerprinting and compilation.
2019-05-08 11:28:07 -07:00
Zach Lute 782266aaee Changed RUST_LOG usage to CARGO_LOG to avoid confusion. 2019-05-08 10:53:02 -07:00
Alex Crichton c2152f0805 Delete rmeta files for rlibs during cargo clean 2019-05-08 09:00:27 -07:00
Alex Crichton 8f032b3bd4 Handle "invalid JSON" from the compiler
Just opportunistically consider lines which start with `{` as valid
JSON, otherwise forward everything else to normal stdout/stderr.
2019-05-08 08:51:40 -07:00
Alex Crichton 95e240448d Switch to -Zemit-artifact-notifications
This is the renamed version of `-Zemit-directives`.
2019-05-08 08:43:09 -07:00
Alex Crichton 4617f78dbc Parse rmeta directives coming from rustc
This commit updates Cargo to process JSON directives emitted by rustc
when we're pipelining compilation. In this mode Cargo will attempt to
start subsequent compilations of crates as soon as possible, fully
completing the features of pipelined compilations in Cargo!
2019-05-08 08:10:26 -07:00
Alex Crichton 1a6e452407 Refactor routing output from rustc/rustdoc
This commit refactors slightly how we actually spawn rustc/rustdoc
processes and how their output is routed. Over time lots has changed
around this, but it turns out that we unconditionally capture all output
from the compiler/rustdoc today, no exceptions. As a result simplify the
various execution functions in the `Executor` trait as well as branches
for emitting json messages. Instead throw everything in the same bucket
and just always look for lines that start with `{` which indicate a
JSON message.

This also fixes a few issues where output printed in each thread is now
routed through the main coordinator thread to handle updating the
progress bar if necessary.
2019-05-08 08:10:26 -07:00
Alex Crichton 127fdfeb89 Implement the Cargo half of pipelined compilation
This commit starts to lay the groundwork for #6660 where Cargo will
invoke rustc in a "pipelined" fashion. The goal here is to execute one
command to produce both an `*.rmeta` file as well as an `*.rlib` file
for candidate compilations. In that case if another rlib depends on that
compilation, then it can start as soon as the `*.rmeta` is ready and not
have to wait for the `*.rlib` compilation.

Initially attempted in #6864 with a pretty invasive refactoring this
iteration is much more lightweight and fits much more cleanly into
Cargo's backend. The approach taken here is to update the
`DependencyQueue` structure to carry a piece of data on each dependency
edge. This edge information represents the artifact that one node
requires from another, and then we a node has no outgoing edges it's
ready to build.

A dependency on a metadata file is modeled as just that, a dependency on
just the metadata and not the full build itself. Most of cargo's backend
doesn't really need to know about this edge information so it's
basically just calculated as we insert nodes into the `DependencyQueue`.
Once that's all in place it's just a few pieces here and there to
identify compilations that *can* be pipelined and then they're wired up
to depend on the rmeta file instead of the rlib file.
2019-05-08 08:10:26 -07:00
Matthias Krüger b48ae60e67 run cargo fmt --all 2019-05-07 14:08:29 +02:00
bors 759b6161a3 Auto merge of #6910 - Eh2406:small-things, r=alexcrichton
Small things

This has two small changes that are worth saving from my most recent attempt to speedup https://github.com/rust-lang/cargo/issues/6258#issuecomment-479204465:

1. This removes the `ConflictCache::contains` added in #6776. Replacing it with a more general and easier to explain system based on the existing `ConflictCache::find_conflicting`.
2. This adds code to print the used part of the input for failing resolver tests. This is very helpful when
    1. The proptest shrinking algorithm is interrupted, at least you have the smallest one found so far.
    2. Hand minimizing, remove a dep and it will tell you all the packages that are no longer needed for the test to fail.
2019-05-06 20:47:49 +00:00
Alex Crichton 23ee20469a Fix skipping over invalid registry packages
This accidentally regressed in the previous caching PR for Cargo.
Invalid lines of JSON in the registry are intended to be skipped over,
but when skipping we forgot to update some indices which meant that all
future versions would fail to parse as well!
2019-05-06 13:01:19 -07:00
Eh2406 45411e2d99 if found a case that causes a panic and did not use all of the input. lets print the part of the input that was used. Helpful in minimization. 2019-05-06 12:37:05 -04:00
bors 0f77ed5f61 Auto merge of #6903 - matthiaskrgr:typos, r=ehuss
fix more typos (codespell)
2019-05-03 16:04:51 +00:00
Alex Helfet 1bcf7f113d Fix. 2019-05-03 16:13:10 +01:00
Alex Helfet f299d1c117 Failing test. 2019-05-03 16:13:10 +01:00
Alex Crichton 783f22bf8c Thread through last update time to index cache
Removed in the previous commit this now adds dedicated tracking for the
last update.
2019-05-03 07:23:00 -07:00
Alex Crichton 5217280ee3 Make registry locking more coarse
This commit updates the locking strategy in Cargo handle the recent
addition of creating a cache of the on-disk index also on disk. The goal
here is reduce the overhead of locking both cognitively when reading but
also performance wise by requiring fewer locks. Previously Cargo had a
bunch of fine-grained locks throughout the index and git repositories,
but after this commit there's just one global "package cache" lock.

This global lock now serves to basically synchronize the entire crate
graph resolution step. This shouldn't really take that long unless it's
downloading, in which case there's not a ton of benefit to running in
parallel anyway. The other intention of this single global lock is to
make it much easier on the sources to not worry so much about lock
ordering or when to acquire locks, but rather they just assert in their
various operations that they're locked.

Cargo now has a few coarse-grained locations where locks are held (for
example during resolution and during package downloading). These locks
are a bit sprinkled about but they have in-code asserts which assert
that they're held, so we'll find bugs quickly if any lock isn't held
(before a race condition is hit that is)
2019-05-03 07:23:00 -07:00
Matthias Krüger b4cd609579 fix more typos (codespell) 2019-05-03 14:22:11 +02:00
bors 7eb9e6ca52 Auto merge of #6881 - k-nasa:feature_cargo_toml_template, r=alexcrichton
Default Cargo.toml template provide help for completing the metadata

## Descriptio
This is new Cargo.toml example.
```toml
[package]
name = "foo"
version = "0.1.0"
authors = ["k-nasa"]
documentation = ""
homepage = ""
repository = ""
readme = ""
categories = []
keywords = []
license = ""
edition = "2018"

[dependencies]

# See more https://doc.rust-lang.org/cargo/reference/manifest.html

```
## Motivation
close: https://github.com/rust-lang/cargo/issues/6845
2019-05-02 14:01:13 +00:00
k-nasa 63a9c7aa6d $cargo fmt --all 2019-05-02 06:39:15 +09:00
k-nasa f781d2df86 test: Add reference link test 2019-05-02 06:29:56 +09:00
Eric Huss f95f55af39 Symlink dSYM on macOS example binaries. 2019-04-29 14:17:28 -07:00
Alex Helfet 987f19d2ea Forbid relative path in registry index (relative URL only), update tests. 2019-04-29 18:39:21 +01:00
Alex Helfet ef00aa9294 Merge remote-tracking branch 'origin/master' into rel-registry-url 2019-04-29 18:03:52 +01:00
bors 2de6c3ef2b Auto merge of #6871 - ehuss:offline-spurious-suggestion, r=alexcrichton
Add some help with updating the registry in offline mode.

This includes the following:

- Move offline tests to a dedicated file.

- If an index has never been downloaded, and `-Z offline` is used, provide a suggestion to run without `-Z offline`.

- ~~If an index needs to be updated, and the network appears to be down, suggest running with `-Z offline`.~~ (removed this)

- The `offline_resolve_optional_fail` test is added to show that resolver errors are still possible (though hopefully rare!).
2019-04-29 14:43:24 +00:00
Eric Huss c6fad3af85 Tweak the error message when updating an empty registry while offline. 2019-04-28 20:04:32 -07:00
Eric Huss c2d12c6ccc Add some help with updating the registry in offline mode.
This makes two changes:

- If an index has never been downloaded, and `-Z offline` is used, provide a
  suggestion to run without `-Z offline`.

- If an index needs to be updated, and the network appears to be down, suggest
  running with `-Z offline`.
2019-04-28 19:45:01 -07:00
Eric Huss 80b9d329ba Move offline tests to a dedicated file. 2019-04-28 19:45:01 -07:00
Eric Huss a9ae668c1b Attempt to debug a spurious test. 2019-04-28 19:25:24 -07:00
Alex Helfet 0dda8f5f72 Added a few tests for relative registry index URLs, fixed a bug. 2019-04-28 00:01:43 +01:00
Aaron Hill f4aac94f12
Properly fix assertion and tests 2019-04-26 00:07:04 -04:00
Aaron Hill df4d2095ac
Prevent 'public' specifier from being used on non-Normal dependencies 2019-04-25 22:42:19 -04:00
Aaron Hill 8a45e5c0b0
Format pub_priv test 2019-04-25 22:42:19 -04:00
Aaron Hill be9ae5e547
Fix error message on stable 2019-04-25 22:42:18 -04:00
Aaron Hill 87f1a4b217
Implement the 'frontend' of public-private dependencies
This is part of https://github.com/rust-lang/rust/issues/44663

This implements the 'frontend' portion of RFC 1977. Once PRs
https://github.com/rust-lang/rust/pull/59335 and
https://github.com/rust-lang/crates.io/pull/1685 are merged,
it will be possible to test the full public-private dependency feature:
marking a dependency a public, seeing exported_private_dependencies
warnings from rustc, and seeing pub-dep-reachability errors from Cargo.

Everything in this commit should be fully backwards-compatible - users
who don't enable the 'public-dependency' cargo feature won't notice any
changes.

Note that this commit does *not* implement the remaining two features of
the RFC:

* Choosing smallest versions when 'cargo publish' is run
* Turning exported_private_dependencies warnings into hard errors when
'cargo publish' is run

The former is a major change to Cargo's behavior, and should be done
in a separate PR with some kind of rollout plan.

The latter is described by the RFC as being enabled at 'some point in
the future'. This can be done via a follow-up PR.
2019-04-25 22:42:18 -04:00
Eh2406 35ff555b70 just give up and make it an error 2019-04-22 17:31:55 -04:00
Eh2406 d0c80ecb4b address nits 2019-04-19 13:58:16 -04:00
Eh2406 4590e74f11 calculate features the hard way 2019-04-18 15:05:34 -04:00
bors 96e9496ba8 Auto merge of #6840 - ehuss:publish-lockfile-updates, r=alexcrichton
publish-lockfile: Various updates

This is a collection of changes to the `publish-lockfile` feature. They are separated by commit (see each for more detailed commit messages), and I can separate them into separate PRs if necessary.

- Move publish-lockfile tests to a dedicated file.
- Regenerate `Cargo.lock` when creating a package.
- Ignore `Cargo.lock` in `cargo install` by default (requires `--locked` to use).
- Add warnings for yanked dependencies.
- Change default of publish-lockfile to true.
2019-04-18 16:01:11 +00:00
Eric Huss 7d202307ce Include Cargo.lock in package checks.
This includes `Cargo.lock` in the git dirty check. It explicitly excludes
`Cargo.lock` as an untracked file, since it is not relevant for the dirty check;
it is only checked if it is committed to git.

This also adds `Cargo.lock` to the "did anything modify this" check during
verification. I don't see a reason to exclude it (particularly since ephemeral
workspaces do not save the lock file).

Also add "Archiving: Cargo.lock" to the verbose output.
2019-04-17 14:06:05 -07:00
bors 6dce2aaddf Auto merge of #6854 - fluffysquirrels:validate-login, r=alexcrichton
Validate registry token before operations that require it.

Fixes https://github.com/rust-lang/cargo/issues/6847 .
2019-04-17 14:56:24 +00:00
bors b978d1179e Auto merge of #6856 - glandium:DYLD_FALLBACK_LIBRARY_PATH, r=alexcrichton
Cleanups wrt DYLD_FALLBACK_LIBRARY_PATH handling
2019-04-17 14:04:03 +00:00
Mike Hommey 416ed031d0 Avoid adding DYLD_FALLBACK_LIBRARY_PATH defaults when it is set
The macos dynamic linker behavior wrt DYLD_FALLBACK_LIBRARY_PATH is to
use the value it is set with, and if there is no such value (the
environment variable is either not set or set but empty), it uses a
default value of $HOME/lib:/usr/local/lib:/usr/lib.

Currently, cargo takes the value of DYLD_FALLBACK_LIBRARY_PATH, prepends
its paths to it, and then unconditionally adds
$HOME/lib:/usr/local/lib:/usr/lib, which in principle, shouldn't happen
if DYLD_FALLBACK_LIBRARY_PATH was set originally.
2019-04-17 08:37:46 +09:00