1079 Commits

Author SHA1 Message Date
Eric Huss
8ac04d1e63 Check for nul in Windows utf-16 wide-string. 2020-12-06 11:40:53 -08:00
Eric Huss
eb081ed301 Workaround fs issue in cargo publish. 2020-12-05 14:10:29 -08:00
Eric Huss
cc6df1d7a5 Implement credential-process. 2020-12-02 19:09:54 -08:00
Igor Matuszewski
aab416f6e6 Use u32/64::to/from_le_bytes instead of bit fiddling 2020-11-09 23:32:39 +01:00
Aaron Hill
939b5ff766
Bump anyhow dependency to 1.0.34 in crates-io crate
This will keep `crates-io` compiling if https://github.com/rust-lang/rust/issues/33953
is fixed. See https://github.com/dtolnay/anyhow/pull/120
2020-11-02 18:45:18 -05:00
Eric Huss
b731190daa Add a future-compatibility warning on allowed feature name characters. 2020-10-27 14:23:35 -07:00
Eric Huss
bcfdf9fbad New namespaced features implementation. 2020-10-23 16:04:41 -07:00
Weihang Lo
d613cd66c7
Merge branch 'master' into feat/glob-pattern 2020-10-18 08:48:30 +08:00
Eric Huss
1a86f232c5 Fix man page links inside option blocks. 2020-10-17 12:15:12 -07:00
Ivan Tham
a90984924d
Add help to substitute macros 2020-10-14 10:01:12 +08:00
Weihang Lo
be31989a43
test: minimal shell quote supoort for cargo-test-support 2020-10-04 22:55:50 +08:00
bors
1ffdfb70eb Auto merge of #8715 - ehuss:contrib, r=alexcrichton
Add contributor guide.

This consolidates and extends the contributor information in a single place. This is an mdbook project, along with a CI job which will build and deploy it to GitHub Pages at <https://rust-lang.github.io/cargo/contrib/>.

You can view a rendered version here: <https://ehuss.github.io/cargo/contrib/>

I don't know if this will actually be helpful to anyone, but I figured it's worth a shot.

NOTE: The CI deploy is designed to preserve the existing gh-pages content.  However, it will **delete the history** on that branch. I think that should be fine, there doesn't seem to be too much interesting stuff there.  I do have a backup in my fork, though. Some extra scrutiny on the code might be wise.  The reason it deletes the history is because deploying mdbook on every push would balloon the repository size.
2020-09-27 07:06:34 +00:00
bors
c369b8c8d8 Auto merge of #8165 - mchernyavsky:force-progress, r=ehuss
Add a term option to configure the progress bar

Closes https://github.com/rust-lang/cargo/issues/7587.
2020-09-23 21:28:14 +00:00
Eric Huss
4d40ef4ef4 Add contributor guide. 2020-09-18 14:01:51 -07:00
mchernyavsky
d649c66191 Add a term option to configure the progress bar 2020-09-16 22:32:31 +03:00
Mukund Lakshman
8d610e1d28 Display formatted output for JSON diffing in tests. 2020-09-12 17:24:53 +01:00
Alex Crichton
bf10871c32 Fix flakiness in close_output test
It looks like stdout/stderr can race as to which gets printed first, but
both are valid for this test.

Closes #8665
2020-08-31 13:15:30 -07:00
bors
964a16a28e Auto merge of #8575 - matthiaskrgr:clippy_v16, r=ehuss
clippy fixes, use matches! macro in more places
2020-08-04 03:47:51 +00:00
Matthias Krüger
f23b91190c use sort_by_key() instead of comparing by keys manually
replace format!() macro by String::from()
use eprintln() instead of manually writing to std::io::stderr
2020-08-03 22:52:01 +02:00
Eric Huss
566706e863 Fix some Windows newline behavior. 2020-08-01 12:22:14 -07:00
Eric Huss
8b878f38cd Add mdman for generating man pages. 2020-08-01 11:13:52 -07:00
Alex Crichton
dc4b695f41 Build host dependencies with opt-level 0 by default
This commit updates Cargo's build of host dependencies to build them
with optimization level 0 by default instead of matching the profile of
the final binary.

Since Cargo's inception build dependencies have, by default, been built
in a profile that largely matches the profile of the final target
artifact. Build dependencies, however, rarely actually need to be
optimized and are often executing very small tasks, which means that
optimizing them often wastes a lot of build time. A great example of
this is procedural macros where `syn` and friends are pretty heavyweight
to optimize, and the amount of Rust code they're parsing is typically
quite small, so the time spent optimizing rarely comes as a benefit.

The goal of this PR is to improve build times on average in the
community by not spending time optimizing build dependencies (build
scripts, procedural macros, and their transitive dependencies). The PR
will not be a universal win for everyone, however. There's some
situations where your build time may actually increase:

* In some cases build scripts and procedural macros can take quite a
  long time to run!
* Cargo may not build dependencies more than once if they're shared with
  the main build. This only applies to builds without `--target` where
  the same crate is used in the final binary as in a build script.

In these cases, however, the `build-override` profile has existed for
some time know and allows giving a knob to tweak this behavior. For
example to get back the previous build behavior of Cargo you would
specify, in `Cargo.toml`:

    [profile.release.build-override]
    opt-level = 3

or you can configure this via the environment:

    export CARGO_PROFILE_RELEASE_BUILD_OVERRIDE_OPT_LEVEL=3

There are two notable features we would like to add in the future which
would make the impact of a change like this smaller, but they're not
implemented at this time (nor do we have concrete plans to implement
them). First we would like crates to have a way of specifying they
should be optimized by default, despite default profile options. Often
crates, like lalrpop historically, have abysmal performance in debug
mode and almost always (even in debug builds) want to be built in
release mode. The second feature is that ideally crate authors would be
able to tell Cargo to minimize the number of crates built, unifying
profiles where possible to avoid double-compiling crates.

At this time though the Cargo team feels that the benefit of changing
the defaults is well worth this change. Neither today nor directly after
this change will be a perfect world, but it's hoped that this change
makes things less bad!
2020-07-17 12:39:41 -07:00
Arlo Siemsen
58869e5ce6 Stop ignoring Array ordering Json comparison tests. Update tests to have sorted order. 2020-07-15 16:32:19 -07:00
bors
2f4097aa6b Auto merge of #8416 - est31:remove_derive, r=alexcrichton
Remove unused serde_derive dependency from the crates.io crate
2020-06-26 16:33:12 +00:00
est31
65591e8144 Remove unused serde_derive dependency 2020-06-26 17:29:09 +02:00
CrLF0710
ad0940c9ad Add missing license field. 2020-06-20 10:03:25 +08:00
Matthias Krüger
6eefe3c236 fix clippy warnings 2020-06-04 00:55:45 +02:00
bors
5847787fef Auto merge of #8274 - Eh2406:8249-repro, r=alexcrichton
reset lockfile information between resolutions

#8249 pointed out that some kind of lockfile data was leaking between calls to the resolver. @ehuss made a reproducing test case. This PR resets the `LockedMap` data structure when calling `register_previous_locks`.

lets see if CI likes it.
fix #8249
2020-06-01 16:01:10 +00:00
Eric Huss
80e55c774b Fix tests with enoent error message on non-english systems. 2020-05-29 12:34:17 -07:00
Eh2406
8ce0d02971 confirm that it is not a bug at resolver level 2020-05-28 15:43:30 -04:00
Daniel Wagner-Hall
556c236f9a Bump to semver 0.10 for VersionReq::is_exact
This stops using `to_string` as a proxy for this now-provided precise API.

This reverts commit b71927224fd9306b2b5bd2b4f8c22268eadfeb6a and bupms the
dependency version in Cargo.toml.
2020-05-25 11:11:45 +01:00
Eric Huss
771b2bca76 Repro 2020-05-24 17:31:30 -04:00
Matthias Krüger
6694fdb677 clippy fixes 2020-05-01 01:16:30 +02:00
bors
90931d9b31 Auto merge of #8077 - faern:use-assoc-int-consts, r=ehuss
Use associated constants directly on primitive types instead of modules

This PR is in no way critical. It's more of a code cleanup. It comes as a result of me making https://github.com/rust-lang/rust/pull/70857 and search-and-replacing all usage of the soft-deprecated ways of reaching primitive type constants.

It makes the code slightly shorter, that's basically it. And showcases the recommended way of reaching these consts on new code :)
2020-04-28 01:56:59 +00:00
Dylan MacKenzie
cf57ce1574 Clear RUSTDOCFLAGS for all tests 2020-04-27 14:31:44 -07:00
bors
97d39aeaac Auto merge of #8139 - mati865:patch-1, r=ehuss
Add windows-gnu CI and fix tests

One remaining failure:
```
---- features::feature_off_dylib stdout ----
running `d:\a\1\s\target\debug\cargo.exe build --features f1`
running `d:\a\1\s\target\debug\cargo.exe run -p bar`
thread 'features::feature_off_dylib' panicked at '
Expected: execs
    but: exited with exit code: 101
--- stdout

--- stderr
   Compiling foo v0.0.1 (D:\a\1\s\target\cit\t663\foo)
   Compiling bar v0.0.1 (D:\a\1\s\target\cit\t663\foo\bar)
    Finished dev [unoptimized + debuginfo] target(s) in 0.69s
     Running `target\debug\bar.exe`
thread 'main' panicked at 'assertion failed: `(left == right)`
  left: `"f1"`,
 right: `"no f1"`', bar\src\main.rs:5:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\bar.exe` (exit code: 101)
', crates\cargo-test-support\src\lib.rs:833:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

failures:
    features::feature_off_dylib
```

I disassembled the dylibs and `cargo run -p bar` correctly rebuilt it inside `target/debug/deps/` but did not copy it to `target/debug`. To further confirm, calling `cp target/debug/deps/foo.dll target/debug/` manually solved the issue.
Any idea?

----

I left `FIXME` in places where import lib should be added with https://github.com/rust-lang/cargo/pull/6875.

`TOOLCHAIN: nightly-x86_64-pc-windows-gnu` can be replaced with beta on Thursday.
2020-04-21 17:03:56 +00:00
Mateusz Mikuła
9f742466f1 Update tests for windows-gnu 2020-04-21 17:25:25 +02:00
bors
9d84c0c734 Auto merge of #7973 - ehuss:index-updates, r=alexcrichton
Several updates to token/index handling.

This attempts to tighten up the usage of token/index handling, to prevent accidental leakage of the crates.io token.

* Make `registry.index` config a hard error. This was deprecated 4 years ago in #2857, and removing it helps simplify things.
* Don't allow both `--index` and `--registry` to be specified at the same time. Otherwise `--index` was being silently ignored.
* `registry.token` is not allowed to be used with the `--index` flag. The intent here is to avoid possibly leaking a crates.io token to another host.
* Added a warning if source replacement is used and the token is loaded from `registry.token`.

Closes #6545
2020-04-20 19:50:40 +00:00
Eric Huss
65274ea7d5 Add a warning when using registry.token with source replacement. 2020-04-19 09:25:32 -07:00
Eric Huss
787e75b797 Add resolver opt-in for new feature resolver. 2020-04-19 08:45:18 -07:00
Eric Huss
4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07:00
Eric Huss
4367ec4d11 Use Path methods instead of fs::metadata. 2020-04-16 22:00:22 -07:00
Linus Färnstrand
c428c0ef41 Use associated constants directly on primitive types instead of modules 2020-04-06 23:37:06 +02:00
Alex Crichton
bac300bda0 Add support for -Cembed-bitcode=no
This commit is the Cargo half of support necessary for
rust-lang/rust#70458. Today the compiler emits embedded bytecode in
rlibs by default, but compresses it. This is both extraneous disk space
and wasted build time for almost all builds, so the PR in question there
is changing rustc to have a `-Cembed-bitcode` flag which, when enabled,
places the bitcode in the object file rather than an auxiliary file (no
extra compression), but also enables `-Cembed-bitcode=no` to disable
bitcode emission entirely.

This Cargo support changes Cargo to pass `-Cembed-bitcode=no` for almost
all compilations. Cargo will keep `lto = true` and such working by not
passing this flag (and thus allowing bitcode to get embedded), but by
default `cargo build` and `cargo build --release` will no longer have
any bitcode in rlibs which should result in speedier builds!

Most of the changes here were around the test suite and various
assertions about the `rustc` command lines we spit out. One test was
hard-disabled until we can get `-Cembed-bitcode=no` into nightly, and
then we can make it a nightly-only test. The test will then be stable
again once `-Cembed-bitcode=no` hits stable.

Note that this is intended to land before the upstream `-Cembed-bitcode`
change. The thinking is that we'll land everything in rust-lang/rust all
at once so there's no build time regressions for anyone. If we were to
land the `-Cembed-bitcode` PR first then there would be a build time
regression until we land Cargo changes because rustc would be emitting
uncompressed bitcode by default and Cargo wouldn't be turning it off.
2020-04-01 14:31:06 -07:00
bors
8a0d4d9c9a Auto merge of #8028 - ehuss:new-proc-macro-decouple, r=alexcrichton
Re-implement proc-macro feature decoupling.

This is essentially a rewrite of #8003. Instead of adding proc-macro to the index, it uses a strategy of downloading all packages before doing feature resolution. Then the package can be inspected for the proc-macro field.

This is a fairly major change. A brief overview:
- `PackageSet` now has a `download_accessible` method which tries to download a minimal set of every accessible package. This isn't very smart right now, and errs on downloading too much. In most cases it should be the same (or nearly the same) as before. It downloads extra in the following cases:
    - The check for `[target]` dependencies checks both host and target for every dependency. I could tighten that up a little so build dependencies only check for the host, but it would add some complexity and I wanted to get feedback first.
    - Optional dependencies disabled by the new feature resolver will get downloaded.
- Removed the loop in computing unit dependencies where downloading used to reside.
- When downloading starts, it should now show a more accurate count of how many crates are to be downloaded. Previously the count would fluctuate while the graph is being built.
2020-03-24 17:57:04 +00:00
Alex Tokarev
38aa4a2353 Remove unused transitive dependencies: miniz_oxide, adler32
Fixes #8019
2020-03-23 19:19:29 +03:00
Eric Huss
944f5049f1 Re-implement proc-macro feature decoupling. 2020-03-22 15:08:02 -07:00
bors
92d0ce8069 Auto merge of #8003 - ehuss:proc-macro-index, r=alexcrichton
Add proc-macro to index, and new feature resolver.

This adds the "pm" field to the index so that Cargo can detect which packages contain a proc-macro without downloading the package.

The second commit builds on that to support proc-macros in the new "de-unification" of the new feature resolver. This prevents dependencies shared between proc-macros and other dependency kinds from having features unified.

cc #7915
2020-03-18 14:00:07 +00:00
Eric Huss
d47a9545db Use Option::as_deref 2020-03-15 18:51:38 -07:00
Eric Huss
0b115f57aa -Zfeatures=host_dep: Support decoupling proc-macro features. 2020-03-15 15:59:42 -07:00