9878 Commits

Author SHA1 Message Date
bishtpawan
8bea1b078f Add yank check for package that needs to be download 2020-08-05 17:31:56 +05:30
Camelid
3045228ee1 Fix typo 2020-08-04 18:23:12 -07:00
bors
1653f35464 Auto merge of #8587 - ehuss:close_output-fix, r=alexcrichton
Fix close_output test.

The close_output test was randomly failing on rust-lang/rust's CI.  This should fix the error. I ran the test in a loop on the rust-lang 16-thread CPU for 10,000 times over the course of 1.5 hours without fail.  The same stress test without this patch failed relatively easily.

I'm a bit on the fence, as this means the test is no longer testing a realistic scenario (the compiler usually doesn't emit a megabyte of diagnostics). Moving this test to a single-threaded runner should also solve the problem. I can't decide if it matters enough to bother.  WDYT?

Closes #8564
2020-08-04 23:14:37 +00:00
Eric Huss
191250b910 Fix close_output test. 2020-08-04 15:50:17 -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
bors
2732539e85 Auto merge of #8456 - ehuss:embedded-man, r=alexcrichton
Display embedded man pages for built-in commands.

This changes `cargo help COMMAND` to display the man page for the given command.  `cargo COMMAND --help` continues to show the basic clap output.

The man pages are embedded in the executable in a compressed format. There's also a copy of the man pages in text format for platforms that do not have the `man` executable (like Windows).

It is unfortunate to check in more pre-generated files. I hope in the future that the usage of asciidoc can be replaced with something else (possibly a custom markdown-based solution).

cc #6104
2020-08-03 21:20:46 +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
0d6881c5bc Change extract_man to not return a Result (not needed). 2020-08-03 12:30:40 -07:00
Eric Huss
0e26eae5c1 Display embedded man pages for built-in commands. 2020-08-03 12:30:38 -07:00
Eric Huss
9138d65e4c Create a dedicated module for help tests. 2020-08-03 12:17:58 -07:00
bors
e9281208cd Auto merge of #8577 - ehuss:mdman, r=alexcrichton
Add mdman for generating man pages.

This introduces a new utility called `mdman` that converts a markdown-formatted document to a man page. This replaces asciidoctor, with the intent to make it easier to contribute, easier to have consistent formatting across platforms, and easier to generate plain-text documents for use on Windows (for #8456). This also includes a number of formatting fixes.

There is some documentation in the `mdman/doc` directory explaining how to use it, and the docs in `src/doc/README.md` have been updated (this explains the structure of the files). The Makefile has been replaced with a simple shell script.

CI has been updated to verify the checked-in docs are up-to-date. Perhaps in the future, these can be generated automatically (perhaps by `build.rs`?), but since that requires a bit of build system work (like upstream rust), this is deferred till later.
2020-08-03 18:37:44 +00:00
bors
af539d2ad8 Auto merge of #8581 - toshokan:fix-error-typo, r=Eh2406
Fix typo 'more then' -> 'more than' in error and comments

There were typos in a reported resolution error and in some comments
2020-08-03 16:10:33 +00:00
bors
2ba80edc67 Auto merge of #8579 - matthiaskrgr:cargo_login_message, r=alexcrichton
cargo login: make login message less ambiguous

The previous message
"please visit https://crates.io/me and paste the API Token below"
Had me waiting for a token to appear in the command line which I would then paste into the website.
Rephrase to
"please paste the api token found on https://crates.io/me below"
to clarify where to paste from and where to paste to.
2020-08-03 15:46:14 +00:00
bors
a5c3b50ce5 Auto merge of #8578 - ehuss:fix-build-cache-link, r=alexcrichton
Fix broken link in Build Cache chapter.
2020-08-03 15:23:11 +00:00
bors
24a00ab803 Auto merge of #8576 - ehuss:fix-broken_intra_doc_links, r=alexcrichton
Fix intra-doc tests for renamed lint.

The lint was renamed in https://github.com/rust-lang/rust/pull/74926.
2020-08-03 15:00:06 +00:00
toshokan
caa8f783ad
Fix typo 'more then' -> 'more than' in error and comments 2020-08-03 09:58:39 -04:00
Matthias Krüger
209701b285 cargo login: make login message less ambiguous
The previous message
"please visit https://crates.io/me and paste the API Token below"
Had me waiting for a token to appear in the command line which I would then paste into the website.
Rephrase to
"please paste the api token found on https://crates.io/me below"
to clarify where to paste from and where to paste to.
2020-08-02 18:04:12 +02:00
Eric Huss
66d2607a97 Fix broken link in Build Cache chapter. 2020-08-01 17:35:46 -07:00
Eric Huss
566706e863 Fix some Windows newline behavior. 2020-08-01 12:22:14 -07:00
Eric Huss
3134eef059 Docs, CI, and tools for building man pages. 2020-08-01 11:14:00 -07:00
Eric Huss
2d4aa38b4f Regenerate man pages using mdman. 2020-08-01 11:14:00 -07:00
Eric Huss
25291c6c36 Remove old HTML generated man pages. 2020-08-01 11:14:00 -07:00
Eric Huss
7b7d80e84a Reformat asciidoc man pages to markdown. 2020-08-01 11:14:00 -07:00
Eric Huss
5594bfa4bd Move asciidoc man pages to markdown. 2020-08-01 11:14:00 -07:00
Eric Huss
8b878f38cd Add mdman for generating man pages. 2020-08-01 11:13:52 -07:00
Eric Huss
1b72e1fbf4 Fix intra-doc tests for renamed lint. 2020-08-01 09:52:11 -07:00
Matthias Krüger
44e794614e use matches! macro in more places 2020-08-01 13:07:44 +02:00
bors
2d5c2381e4 Auto merge of #8573 - alexcrichton:hash-same, r=ehuss
Use the same index location on nightly as beta

Closes #8572
2020-07-31 21:56:08 +00:00
Alex Crichton
6f29fb76fc Use the same index location on nightly as beta
Closes #8572
2020-07-31 08:30:35 -07:00
bors
c4e93dc5ed Auto merge of #8566 - alexcrichton:less-output, r=ehuss
Don't print to raw stderr in test

Avoids polluting the output of tests with Cargo's build output.
2020-07-31 03:03:35 +00:00
bors
e531f54954 Auto merge of #8569 - euclio:deprecation-message, r=ehuss
relax deprecated diagnostic message check

Needed to unblock rust-lang/rust#74785.
2020-07-31 01:43:43 +00:00
Andy Russell
537a020267
relax deprecated diagnostic message check 2020-07-30 21:04:45 -04:00
bors
d484b65ab7 Auto merge of #8478 - oli-obk:master, r=alexcrichton
Emit the `test` field in cargo metadata

This is needed so `cargo-metadata` can expose it: https://github.com/oli-obk/cargo_metadata/issues/114
2020-07-30 14:27:27 +00:00
Alex Crichton
d0983fb3f0 Don't print to raw stderr in test
Avoids polluting the output of tests with Cargo's build output.
2020-07-30 07:20:43 -07:00
Oliver Scherer
95b22d2874 Emit the test field in cargo metadata 2020-07-30 09:50:46 +02:00
bors
974eb438da Auto merge of #8560 - alexcrichton:o0-for-realz, r=ehuss
Fix O0 build scripts by default without `[profile.release]`

This fixes an issue where #8500 didn't quite work as expected, since it
only worked if a crate had a `[profile.release]` section.
2020-07-29 16:15:05 +00:00
Alex Crichton
005e1a442a Fix O0 build scripts by default without [profile.release]
This fixes an issue where #8500 didn't quite work as expected, since it
only worked if a crate had a `[profile.release]` section.
2020-07-29 08:41:11 -07:00
bors
21a1e1544b Auto merge of #8561 - icorbrey:git-dep-lock-docs, r=ehuss
Emphasize git dependency version locking behavior.

Added a section in `src/doc/src/reference/specifying-dependencies.md` clarifying Cargo's version locking behavior when adding `git` dependencies:

```
Once a `git` dependency has been added, Cargo will lock that dependency to the
latest commit at the time. New commits will not be pulled down automatically
once the lock is in place. However, they can be pulled down manually with
`cargo update`.
```

Resolves #8555
2020-07-29 14:58:31 +00:00
bors
b1d4a2ebb1 Auto merge of #8554 - alexcrichton:update-lockfile-rollout, r=ehuss
Update lock file encodings on changes

This commit alters Cargo's lockfile encoding update strategy from its
previous incarnation. Previously Cargo had two versions, one for new
lock files and one for old lock files. Each of these versions were
different and would affect how Cargo manages lock file updates. The
intention was that we'd roll out defaults to new lock files first and
then later to preexisting lock files. This requires two separate
changes, though, and it's not necessarily clear when to start updating
old lock files. Additionally when old lock files were opted in it would
break builds using `--locked` if they simply updated Cargo because Cargo
would would want to bring the lock file versions forward.

The purpose of this change is to solve these issues. The new strategy
for updating a lock file's encoding is to simply preserve what's already
existing on the filesystem until we actually decide to write out a new
lock file. When Cargo updates a lock file on-disk then it will, at that
time, update the lock file encoding to whatever the current default is.
This means that there's only one version number to keep track of (the
default for encoding). Cargo will always preserve the preexisting
encoding unless another change is required to the lock file.
2020-07-29 14:34:30 +00:00
bors
b170a07d40 Auto merge of #8559 - ehuss:fix-lto-tests-flaky, r=alexcrichton
Fix sporadic lto test failures.

These tests can fail because the order of the messages is not deterministic.  The two `foo` jobs start in parallel, so the order can be swapped.  Results in an error like:

```
---- lto::test_profile stdout ----
running `/home/runner/work/cargo/cargo/target/debug/cargo test -v`
thread 'lto::test_profile' panicked at '
Expected: execs
    but: differences:
  6 - |[RUNNING] `rustc --crate-name foo [..]--crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no[..]|
    + |     Running `rustc --crate-name foo --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C lto=thin -C debuginfo=2 --test -C metadata=af771ad588185fac -C extra-filename=-af771ad588185fac --out-dir /home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps -L dependency=/home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps --extern bar=/home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps/libbar-398704963dd4e38b.rlib`|

  7 - |[RUNNING] `rustc --crate-name foo [..]--emit=dep-info,link -C lto=thin [..]--test[..]|
    + |     Running `rustc --crate-name foo --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -Cembed-bitcode=no -C debuginfo=2 -C metadata=1e8f5d385f4ffeb6 -C extra-filename=-1e8f5d385f4ffeb6 --out-dir /home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps -L dependency=/home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps --extern bar=/home/runner/work/cargo/cargo/target/cit/t1080/foo/target/debug/deps/libbar-398704963dd4e38b.rmeta`|
```

The failure rate is pretty small (depends heavily on the hardware).
2020-07-29 14:02:16 +00:00
Isaac Corbrey
13e789e01f fix: Emphasize git dependency version locking behavior. 2020-07-29 04:49:44 -09:00
bors
6fb343394c Auto merge of #8558 - JohnTitor:fix-build-std, r=alexcrichton
build-std: Fix libraries paths following upstream

Fixes #8557
2020-07-29 13:40:14 +00:00
Eric Huss
95330627d3 Fix sporadic lto test failures. 2020-07-28 22:25:45 -07:00
Yuki Okushi
7c77fedabb
Fix mock-std as well 2020-07-29 12:41:49 +09:00
Yuki Okushi
769ac7cc91
Fix libraries paths following upstream 2020-07-29 12:41:49 +09:00
bors
0d79ba656c Auto merge of #8553 - alexcrichton:more-maybe-spurious, r=ehuss
Flag git http errors as maybe spurious

This showed up in #8544 with an error message of "stream ended at an
unexpected time; class=Http" which sounds like a spurious error.
Termination of a network connection can happen at any time! For now try
to assist in that error by adding another class of error to the list of
maybe spurious errors.
2020-07-28 19:33:38 +00:00
Alex Crichton
fdbe9f8e05 Update lock file encodings on changes
This commit alters Cargo's lockfile encoding update strategy from its
previous incarnation. Previously Cargo had two versions, one for new
lock files and one for old lock files. Each of these versions were
different and would affect how Cargo manages lock file updates. The
intention was that we'd roll out defaults to new lock files first and
then later to preexisting lock files. This requires two separate
changes, though, and it's not necessarily clear when to start updating
old lock files. Additionally when old lock files were opted in it would
break builds using `--locked` if they simply updated Cargo because Cargo
would would want to bring the lock file versions forward.

The purpose of this change is to solve these issues. The new strategy
for updating a lock file's encoding is to simply preserve what's already
existing on the filesystem until we actually decide to write out a new
lock file. When Cargo updates a lock file on-disk then it will, at that
time, update the lock file encoding to whatever the current default is.
This means that there's only one version number to keep track of (the
default for encoding). Cargo will always preserve the preexisting
encoding unless another change is required to the lock file.
2020-07-28 12:17:55 -07:00
bors
2d26633171 Auto merge of #8542 - CPerezz:aliases, r=ehuss
Display builtin aliases with `cargo --list`

As stated in #8486 it would help to the discovery of the
builtin aliases the facto of printing them with the
`cargo --list` command.

- Extracted the builtin aliases currently implemented to a
separated `const`.
- Make all of the functions that interact with these aliases
point to that function.
- Refactored the `list_commands` fn in order to include with the
builtin and external commands, the builtin aliases that come with
cargo by default.
- Added a test that checks that the aliases that currently
are builtin with cargo are indeed being printed with the rest
of the commands when `cargo --list` is called.

The output on my machine looks like this:
```
$ cargo --list
Installed Commands:
    b                    alias: build
    bench                Execute all benchmarks of a local package
    build                Compile a local package and all of its dependencies
    c                    alias: check
    check                Check a local package and all of its dependencies for errors
    clean                Remove artifacts that cargo has generated in the past
    doc                  Build a package's documentation
    fetch                Fetch dependencies of a package from the network
    fix                  Automatically fix lint warnings reported by rustc
    generate-lockfile    Generate the lockfile for a package
    git-checkout         This subcommand has been removed
    init                 Create a new cargo package in an existing directory
    install              Install a Rust binary. Default location is $HOME/.cargo/bin
    locate-project       Print a JSON representation of a Cargo.toml file's location
    login                Save an api token from the registry locally. If token is not specified, it will be read from stdin.
    metadata             Output the resolved dependencies of a package, the concrete used versions including overrides, in machine-readable format
    new                  Create a new cargo package at <path>
    owner                Manage the owners of a crate on the registry
    package              Assemble the local package into a distributable tarball
    pkgid                Print a fully qualified package specification
    publish              Upload a package to the registry
    r                    alias: run
    read-manifest        Print a JSON representation of a Cargo.toml manifest.
    run                  Run a binary or example of the local package
    rustc                Compile a package, and pass extra options to the compiler
    rustdoc              Build a package's documentation, using specified custom flags.
    search               Search packages in crates.io
    t                    alias: test
    test                 Execute all unit and integration tests and build examples of a local package
    tree                 Display a tree visualization of a dependency graph
    uninstall            Remove a Rust binary
    update               Update dependencies as recorded in the local lock file
    vendor               Vendor all dependencies for a project locally
    verify-project       Check correctness of crate manifest
    version              Show version information
    yank                 Remove a pushed crate from the index
    clippy
    clippy
    clippy
    clippy
    flamegraph
    fmt
    fmt
    fmt
    fmt
    miri
    miri
    miri
    miri
    outdated
    tree
```

As discussed with @ehuss the `BTreeSet` enforces `Ord` therefore, the aliases get mixed with the commands since they're passed through the same function.

It can be refactored to appear separately, but, the code will be more spread and now it's all in just one file (which I believe is easier to maintain and review).

Closes #8486
2020-07-28 19:09:02 +00:00
CPerezz
2ae8df65d8 Remomve builtin_aliases duplicate declaration
As @ehuss correctly suggested, we could just declare
in one `const` structure for every builtin alias the
following: `(alias, aliased_command, description)`.

Therefore, the suggestion has been applied and the
`BUILTIN_ALIASES` const has been refactored.

Also, the `builtin_aliases_execs` now parses the
`BUILTIN_ALIASES` const searching for a
"possible alias command" returning an option with the
previous info structure or `None`.
2020-07-28 20:53:59 +02:00
bors
cdbd9b7f9b Auto merge of #7950 - aleksator:4854_non_existent_features_error, r=ehuss
Check manifest for requiring nonexistent features

Fixes #4854: Examples requiring a nonexistent feature should be an error

Thanks @lukaslueg with his https://github.com/rust-lang/cargo/pull/4874 for the inspiration!
2020-07-28 18:44:20 +00:00