Commit graph

10845 commits

Author SHA1 Message Date
Jade 6128b54b8a docs: cargo-doc.browser -> doc.browser; mention in cargo-{rust,}doc.1 2021-05-20 22:52:49 -07:00
Jade 50486be0c0 testsuite/doc: Check the arguments used to invoke the browser
Previously we apparently weren't doing this as we weren't checking
stdout.
2021-05-15 18:59:24 -07:00
Jade ed46a9a4de test path and args 2021-05-15 14:23:44 -07:00
Jade 6ea1eb3f7e Move browser setting to [doc], use PathAndArgs 2021-05-15 13:23:55 -07:00
Jade e840c8e81c Add a cargo-doc.browser config option
The idea of this option is to allow cargo to use a separate browser from
the rest of the system. My motivation in doing this is that I want to
write a script that adds a symbolic link in some web root on my system
such that I can access my docs via the http protocol to avoid the
limitations of the file protocol that are accessibility problems for me.
For instance, zoom is not retained across multiple pages and Stylus
filters don't work well.
2021-05-10 21:04:41 -07:00
bors e51522ab3d Auto merge of #9375 - vojtechkral:tests-target-dir, r=ehuss
Add CARGO_TARGET_TMPDIR env var for integration tests & benches

Hi.
Recently I [ran into](https://github.com/vojtechkral/bard/blob/main/tests/util/mod.rs#L32) the problem that integration tests don't have a good way to figure out where `target` dir is.

Knowing where `target` is is useful for integration tests that need to setup some filesystem structure for test cases. In fact `cargo` itself does this too (and figures out the path rather clumsily).

Another popular way of doing this is to create a directory in `/tmp` (or quivalent on other systems), however, I believe using subdirectory in `target` is better as testcases are easier to debug that way and temporary  locations aren't polluted.

I think this would also address some concerns in #2841

Another solution might be to provide a dedicated subdirectory in `target` for this, something like `target/scratchpad`, but I'm not convinced this is warranted... Edit: That's what was decided to do, see below...

Let me know what you think 🙂
2021-05-07 21:29:52 +00:00
bors deb2c61cf2 Auto merge of #9464 - ehuss:version-bump, r=Eh2406
Bump to 0.55.0, update changelog
2021-05-07 18:59:28 +00:00
Eric Huss b25b4087fc Update changelog for 1.53 2021-05-07 09:00:22 -07:00
Eric Huss c38cd662bc Bump to 0.55.0 2021-05-07 08:10:28 -07:00
Vojtech Kral 53343bc398 Use CARGO_TARGET_TMPDIR in integration tests if available 2021-05-07 00:03:01 +02:00
Vojtech Kral 64bfe7f1de Add CARGO_TARGET_TMPDIR env var for integration tests & benches
The variable is set to $target_dir/$config/tmp
This is a directory where tests & benches can place testcasei-related data
for use by the tests.
cargo makes sure the directory exists when building tests/benches.
2021-05-06 23:47:28 +02:00
bors 29ea494f29 Auto merge of #9457 - ehuss:unstable-doc-updates, r=alexcrichton
Some updates to the unstable documentation

* Extends the future-incompat docs.
* Adds `cargo rustc --print`
* Adds a table of contents.  The chapter is really long and unorganized, so I hope this can maybe help make things easier to discover.
2021-05-05 14:04:05 +00:00
Eric Huss fa3761c61b Add a TOC to the unstable chapter. 2021-05-04 09:24:11 -07:00
Eric Huss abbd2b0bb1 Add cargo rustc --print unstable docs. 2021-05-04 08:55:23 -07:00
Eric Huss dda0d65b39 Elaborate a little on future-incompat unstable docs. 2021-05-04 08:51:57 -07:00
Eric Huss fac524376d Some cleanup. 2021-05-04 08:50:41 -07:00
bors f8cb939f94 Auto merge of #9456 - ehuss:env-split-debuginfo, r=alexcrichton
Add CARGO_PROFILE_<name>_SPLIT_DEBUGINFO to env docs.

I forgot this needed to be updated.
2021-05-04 15:40:22 +00:00
Eric Huss 93f3746389 Add CARGO_PROFILE_<name>_SPLIT_DEBUGINFO to env docs. 2021-05-04 06:12:57 -07:00
Eric Huss 86080ab4a8 Remove trailing spaces. 2021-05-04 06:11:42 -07:00
bors 1228f49d74 Auto merge of #9438 - ehuss:report-subcommand, r=alexcrichton
Add `report` subcommand.

This renames the `cargo describe-future-incompatibilities` subcommand to `cargo report future-incompatibilities`. The intent here is to have a general `report` subcommand that can be used for other reports in the future. This helps avoid the proliferation of top-level subcommands, and to help keep the CLI a little more organized.
2021-05-03 14:41:36 +00:00
bors db741ac733 Auto merge of #9186 - weihanglo:issue-9054, r=alexcrichton
Respect Cargo.toml `[package.exclude]` even not in a git repo.

May resolves #9054

This bug (or feature?) has been lingering for a while. #7680 fixed the `cargo package` part but `cargo vendor` is still affected by the heuristic rule of ignoring dotfiles. ~~I propose to drop the rule and include dotfiles by default even if the package is not under git-controlled~~. See below.

## Updated: Changes Summary

`cargo vendor` vendors dependencies without git-controlled but `cargo package` often runs under a VCS like git. [These lines](https://github.com/rust-lang/cargo/blob/1ca930b/src/cargo/sources/path.rs#L161-L168) are where they diverges: `fn list_files_walk_except_dot_files_and_dirs` builds [its own ignore instance], which cannot merge with other filter rules from `[package.exclude]`. This causes some patterns to not work as expected, such as re-including file after ignoring dotfiles `[.*, !negated_file]`.

To make re-include (negate) rule works, this patch adds the excluding dotfiles rule directly into the `package.exclude` ignore instance if **_no include option nor git repo exists_**. Other old behaviors should not change in this patch.

[its own ignore instance]: https://github.com/rust-lang/cargo/blob/1ca930b6/src/cargo/sources/path.rs#L364-L366
2021-05-01 15:35:48 +00:00
bors 468314fc82 Auto merge of #9439 - ehuss:contrib-crates, r=Eh2406
Document the other crates in the codebase in the contrib guide.
2021-05-01 02:17:06 +00:00
bors f3e13226d6 Auto merge of #9440 - ehuss:fix-metrics-test, r=Eh2406
Fix problem with metrics test.

The `counter_zero_slot` test was checking for an assertion that only fires in a debug build. However, upstream `rust-lang/rust` runs tests in `--release` mode. This unblocks the upstream update.
2021-04-30 21:50:27 +00:00
Eric Huss 58ab9c116f Fix problem with metrics test. 2021-04-30 14:03:16 -07:00
Eric Huss b3d922369a Document the other crates in the codebase in the contrib guide. 2021-04-30 13:24:35 -07:00
Eric Huss ff49b829e6 Add report subcommand. 2021-04-30 13:01:21 -07:00
bors 6701e33f69 Auto merge of #9395 - weihanglo:issue-8483, r=alexcrichton
Show transfer rate when fetching/updating registry index

Possibly fixes #8483.

To avoid blinking too frequently, update rate is throttled by one second.

I am not sure how to write tests for it 😂

<img width="896" alt="image" src="https://user-images.githubusercontent.com/14314532/115879831-ac62fb00-a47c-11eb-9b12-735ce8192ebe.png">

# Updated (2020-04-28)

Current looking

```
    Updating crates.io index
       Fetch [==>                      ]  14.50%, 258.45KiB/s

    Updating crates.io index
       Fetch [======>                  ]  40.50%, (1234/282342) resolving deltas
```
2021-04-30 14:12:40 +00:00
bors 96be6747cd Auto merge of #9434 - ehuss:collision-doc-j1, r=Eh2406
Fix collision doc tests randomly failing.

This fixes some tests that were randomly failing on CI. The cause is that #9419 added a remove_dir_all on the `doc` directory. However, if two jobs are trying to write to that directory at the same time, this can cause errors.  The failure rate is low (a little over 1%), and I was unable to reproduce locally (only on GitHub's CI and only on the Windows job).

The solution is to run the jobs with -j1 so they run serially.

 I only saw errors for `collision_doc_sources`, but to be on the safe side I added j1 to similar tests.
2021-04-29 18:21:49 +00:00
Eric Huss 5003d53c79 Fix collision doc tests randomly failing. 2021-04-29 10:42:42 -07:00
bors c564ae8a94 Auto merge of #9429 - ehuss:unstable-updates2, r=alexcrichton
Add missing tracking issues and unstable docs.

Adds some missing tracking issues, and adds documentation for `-Z doctest-in-workspace`.
2021-04-29 15:22:26 +00:00
bors 5b76b84f7a Auto merge of #9421 - lf-:meowwwwww, r=alexcrichton
Fix dep-info files emitting paths relative to deps' roots

Sample `shoo.d` file prior to this change is below, note the `build.rs`
at the end, which was not from my package.

From booping the debugger, I found this was coming from
`compiler_builtins`.  This is not really their bug though: if a build.rs
asks for rerun-if-changed on some crate relative path, this will happen
in general. So I've fixed it in Cargo and added a test to prevent it
regressing.

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s build.rs
```

This change fixes it so it's like:

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.39/build.rs /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.14/build.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s
```
2021-04-29 14:54:23 +00:00
bors 3b05f5fb6a Auto merge of #9428 - rust-lang:dependabot/add-v2-config-file, r=alexcrichton
Upgrade to GitHub-native Dependabot

_Dependabot Preview will be shut down on August 3rd, 2021. In order to keep getting Dependabot updates, please merge this PR and migrate to GitHub-native Dependabot before then._

Dependabot has been fully integrated into GitHub, so you no longer have to install and manage a separate app. This pull request migrates your configuration from Dependabot.com to a config file, using the [new syntax][new_syntax]. When merged, we'll swap out `dependabot-preview` (me) for a new `dependabot` app, and you'll be all set!

With this change, you'll now use the [Dependabot page in GitHub][dependabot_page], rather than the [Dependabot dashboard][dashboard], to monitor your version updates, and you'll configure Dependabot through the new config file rather than a UI.

If you've got any questions or feedback for us, please let us know by creating an issue in the [dependabot/dependabot-core][issues] repository.

[Learn more about migrating to GitHub-native Dependabot][learn]

Please note that regular ``@dependabot`` commands do not work on this pull request.

[dashboard]: https://app.dependabot.com/
[dependabot_page]: https://github.com/rust-lang/cargo/network/updates
[issues]: https://github.com/dependabot/dependabot-core/issues/new?assignees=%40dependabot%2Fpreview-migration-reviewers&labels=E%3A+preview-migration&template=migration-issue.md
[learn]: http://docs.github.com/code-security/supply-chain-security/upgrading-from-dependabotcom-to-github-native-dependabot
[new_syntax]: https://help.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates
[org_secrets_url]: https://github.com/organizations/rust-lang/settings/secrets/dependabot
[repo_secrets_url]: https://github.com/rust-lang/cargo/settings/secrets/dependabot
2021-04-29 14:26:04 +00:00
Eric Huss 06fa940b47 Add missing tracking issues and unstable docs. 2021-04-28 14:39:55 -07:00
dependabot-preview[bot] 55f7d93e88
Upgrade to GitHub-native Dependabot 2021-04-28 21:38:01 +00:00
Weihang Lo e4d4347223 comment about caveat of current transfer rate refresh 2021-04-29 01:00:14 +08:00
Weihang Lo 9df531b223 fix: bytes per second should not prefix with i 2021-04-29 00:58:58 +08:00
bors e9e09077a1 Auto merge of #9425 - JohnTitor:tweak-cargo-fix-test, r=alexcrichton
Only deny the `unused_mut` lint

This is needed for rust-lang/rust#83004 to pass CI.
2021-04-28 14:16:49 +00:00
Yuki Okushi e5ab39145f Only deny the unused_mut lint 2021-04-28 17:59:57 +09:00
Jade b998364e6b Fix test on Windows: reprise 2021-04-27 22:30:35 -07:00
Jade 5bba21afe4 Fix the test on Windows 2021-04-27 21:21:56 -07:00
Weihang Lo a89b1e8a9f
refactor: pass Instant to MetricsCounter 2021-04-27 22:46:46 +08:00
bors 4369396ce7 Auto merge of #9419 - ehuss:doc-meta-rebuild, r=alexcrichton
Fix rebuild issues with rustdoc.

This fixes two issues related to rebuilds with rustdoc:

* Switching features when running `cargo doc` would result in Cargo not rebuilding the documentation. This is because it was keeping the fingerprints in separate directories based on the features used. However, the rustdoc output isn't keyed off the metadata hash, so although the old fingerprint seemed "up to date", in reality the documentation was rewritten and needs to be rebuilt. The solution is to use a simplified hash for the fingerprint directory name.
* Removing items does not remove the files from the doc directory. This changes it to clear the package's doc directory before running rustdoc, to ensure any stale files are removed.

I'm a little concerned about potential performance impact of running `remove_dir_all`, but I think it shouldn't be too bad?

Fixes #7370
2021-04-27 14:35:53 +00:00
bors 52a0ca5cc3 Auto merge of #9418 - ehuss:always-meta, r=alexcrichton
Always use full metadata hash for -C metadata.

This changes it so that cargo always uses the full metadata hash for `-C metadata`. This ensures that even if a unit isn't using `-C extra-filename` that the symbol hashing uses all the fields used in the other cases.

This fixes an issue on macOS where a combination of split-debuginfo and incremental caused the same `.o` filenames to be used, which caused corruption in the incremental cache (see issue for details).

Fixes #9353.
2021-04-27 14:08:31 +00:00
Jade fc5840d175 Fix dep-info files emitting paths relative to deps' roots
Sample `shoo.d` file prior to this change is below, note the `build.rs`
at the end, which was not from my package.

From booping the debugger, I found this was coming from
`compiler_builtins`.  This is not really their bug though: if a build.rs
asks for rerun-if-changed on some crate relative path, this will happen
in general. So I've fixed it in Cargo and added a test to prevent it
regressing.

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s build.rs
```

This change fixes it so it's like:

```
target/riscv64imac-mu-shoo-elf/release/shoo: /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.39/build.rs /home/jade/.cargo/registry/src/github.com-1ecc6299db9ec823/log-0.4.14/build.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/core_arch_docs.md /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/macros.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/mod.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd.rs /home/jade/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/simd_llvm.rs crates/build_bits/src/lib.rs shoo/src/main.rs shoo/src/task.rs shoo/src/vectors.s
```
2021-04-27 05:08:33 -07:00
Weihang Lo de84f352e4
refactor: use metrics counter as an abstaction 2021-04-27 14:23:44 +08:00
Weihang Lo a813ba0070
feat: add metrics counter utility 2021-04-27 14:23:42 +08:00
Eric Huss 44c549e650 Clear rustdoc output just before running rustdoc. 2021-04-26 21:04:01 -07:00
Eric Huss 77855f3636 Use consolidated fingerprint directory for rustdoc. 2021-04-26 21:02:29 -07:00
Eric Huss 256c43c2f1 Always use full metadata hash for -C metadata. 2021-04-26 20:18:53 -07:00
bors d1c0a9d9ca Auto merge of #9030 - Ekleog:target-setting, r=alexcrichton
Expose build.target .cargo/config setting as packages.target in Cargo.toml

Hey!

I'm trying to do my first cargo contribution by implementing per-crate target settings as per [the irlo thread](https://internals.rust-lang.org/t/proposal-move-some-cargo-config-settings-to-cargo-toml/13336) ; and I think I have a draft that looks good-ish (the root units returned by `generate_targets` have the right kinds set).

Closes #7004

**_Edit: the below problem description is now solved in the latest version of this PR, please ignore_**

But for some reason running on a test project now blocks on `Blocking waiting for file lock on build directory` and I have literally no idea how my changes could trigger this… would anyone have an idea of how the changes could lead to infinitely blocking there? (I already tried cargo clean just in case and it didn't appear to help)

FWIW, the output that looks hopeful to me is, on my testbed workspace:
```
Root units [out of generate_targets] are [...]:
 - package ‘smtp-client’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-server’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-config’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-message-fuzz’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-rpc’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-config-example’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-message-fuzz’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-config-example’ with kind ‘Target(CompileTarget { name: "wasm32-unknown-unknown" })’
 - package ‘smtp-queue’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-message-fuzz’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-message’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-server-fuzz’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘yuubind-config’ with kind ‘Target(CompileTarget { name: "wasm32-unknown-unknown" })’
 - package ‘yuubind’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
 - package ‘smtp-queue-fs’ with kind ‘Target(CompileTarget { name: "x86_64-unknown-linux-gnu" })’
```
(where both `yuubind-config` and `yuubind-config-example` are being configured to be `wasm32-unknown-unknown` and the other ones stay as host).

Interestingly enough, if I remove the `target` setting from `yuubind-config` (and leave it on `yuubind-config-example`) then it does no longer block on waiting for file lock on build directory, even though it does not actually compile with `wasm32-unknown-unknown`. And it does appear to correctly build yuubind-config-example as wasm32.

My investigation shows that it appears to happen iff there is a package with `package.target` being set that has dependencies.

This most likely is a bug in my code (eg. I build only the root units and not the whole unit graph maybe?), and am going to keep investigating it as such, but maybe someone would already know how dependency resolution could interact with build lock acquisition and give me hints?

Anyway, thank you all for all you do cargo!
2021-04-26 15:00:47 +00:00