Commit Graph

13244 Commits

Author SHA1 Message Date
Chocobo1 b864cb4278
Use proper git URL for GitHub repos
Follow up of ce174d4efc.
2022-12-29 16:18:48 +08:00
bors 09c5b26c76 Auto merge of #11516 - hi-rustin:rustin-patch-example, r=ehuss
Add `registry.default` example
2022-12-29 02:45:39 +00:00
hi-rustin 3f3eaa0f08 Add `registry.default` example
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-12-29 09:55:25 +08:00
bors 5a574d39f3 Auto merge of #10690 - AtkinsChang:vendor, r=hi-rustin
Support vendoring with different revs from same git repo

### What does this PR try to resolve?

Fixes #10667

### How should we test and review this PR?
test case is included
2022-12-26 22:16:55 +00:00
bors 2381cbdb4e Auto merge of #11478 - rvolosatovs:fix/bindeps-target, r=weihanglo
fix: deduplicate dependencies by artifact target

### What does this PR try to resolve?

In cases when a compile target is specified for a bindep and the crate depending on it, cargo fails to deduplicate the crate dependencies and attempts to build the dependent crate only once with non-deterministic feature set, which breaks e.g. https://github.com/rvolosatovs/musl-bindep-feature-bug

Fix the issue by including the optional artifact compile target in the `Unit` in order to avoid wrongfully deduplicating the dependent crates

Fixes https://github.com/rust-lang/cargo/issues/11463
Fixes https://github.com/rust-lang/cargo/issues/10837
Fixes https://github.com/rust-lang/cargo/issues/10525

Note, that this issue is already accounted for by `cargo`, but in different context a similar situation can occur while building the build script, which:
1. may be built for different target than the actual package target
2. may contain dependencies with different feature sets than the same dependencies in the dependency graph of the package itself

That's why this PR is simply reusing the existing functionality for deduplication

### How should we test and review this PR?

Build https://github.com/rvolosatovs/musl-bindep-feature-bug

### Additional information

This is based on analysis by `@weihanglo` in https://github.com/rust-lang/cargo/issues/10837#issuecomment-1339365374
I experimented with adding the whole `UnitFor` to the internal unit struct, but that seems unnecessary.

It would probably be nicer to refactor `IsArtifact` and instead turn it into a 3-variant enum with a possible compile target, but I decided against that to minimize the diff. Perhaps it's worth a follow-up?
2022-12-23 12:19:27 +00:00
bors 2a4a9b48fb Auto merge of #11503 - willcrichton:scrape-dev-deps-diagnostic, r=weihanglo
Add warning if potentially-scrapable examples are skipped due to dev-dependencies

### What does this PR try to resolve?

Another point of feedback I've received on the scrape-examples feature is that the dev-dependency situation is quite confusing and subtle. To make users more aware of the issue, I added a warning where Cargo will alert users when examples are skipped due to a dev-dependency requirement, along with proposing a fix.

### How should we test and review this PR?

The test `docscrape::no_scrape_with_dev_deps` has been updated to reflect this new warning.

r? `@weihanglo`

(PS thank you for the reviews Weihang. I know I'm doing lots of little patches right now to get this feature finalized. If you want to share the reviewing burden on scrape-examples with anyone else, let me know!)
2022-12-22 23:55:20 +00:00
Will Crichton 1c4065c52e Simplify code and output of skipped_examples warning 2022-12-22 12:37:11 -08:00
Roman Volosatovs 385bba3cf2
fix: share artifact and build dependencies
This prevents collisions for transitive dependencies

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
2022-12-22 16:16:12 +01:00
Roman Volosatovs 548b2528fb
test: reproduce bindep dependency collision bug
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
2022-12-22 16:16:12 +01:00
Roman Volosatovs e99c0bbe28
fix: deduplicate dependencies by artifact target
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
2022-12-22 14:45:25 +01:00
Roman Volosatovs 6d43fa64ec
refactor: simplify rust-lang#10525 test case
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
2022-12-22 14:45:25 +01:00
bstrie 386645e990
test: add test for #10525 2022-12-22 14:45:25 +01:00
Roman Volosatovs 4677a7cce5
test: reproduce transitive bindep dependency bug
This is a unit test reproducing the bindep transitive dependency bug based upon examples from
- https://github.com/rust-lang/cargo/issues/10837
- https://github.com/rust-lang/cargo/issues/11463

Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
2022-12-22 14:45:21 +01:00
Atkins Chang f114298149
Support vendoring with different revs from same git repo
Signed-off-by: Atkins Chang <atkinschang@gmail.com>
2022-12-21 11:44:27 +08:00
Atkins Chang 0200d3b3ca
Add test for vendor with different revs from same git repo
Signed-off-by: Atkins Chang <atkinschang@gmail.com>
2022-12-21 11:44:23 +08:00
Will Crichton 6b9a28eb21 Add warning if potentially-scrapable examples are skipped due to dev-dependencies 2022-12-20 14:32:31 -08:00
bors 74c7aab19a Auto merge of #11499 - willcrichton:example-analyzer, r=weihanglo
Don't scrape examples from library targets by default

### What does this PR try to resolve?

Based on some [early feedback](https://www.reddit.com/r/rust/comments/zosle6/feedback_requested_rustdocs_scraped_examples/) about the scrape-examples feature, both documentation authors and consumers did not consider examples useful if they are scraped from a library's internals, at least in the common case. Therefore this PR changes the default behavior of `-Zrustdoc-scrape-examples` to *only* scrape from example targets, although library targets can still be configured for scraping.

### How should we test and review this PR?

I have updated the `docscrape` tests to reflect this new policy, as well as the Unstable Options page in the Cargo book.

r? `@weihanglo`
2022-12-20 21:10:16 +00:00
Will Crichton eb829cfb35 Improve failed scrape diagnostic 2022-12-20 12:13:41 -08:00
bors 1d8cdaa01e Auto merge of #11494 - ehuss:stabilize-diagnostic-width, r=weihanglo
Stabilize terminal-width

This stabilized the passing of the `--diagnostic-width` flag to rustc and rustdoc so that they will format diagnostics to fit within the terminal size. Previously they always assume the width is 140. The diagnostics are trimmed with `...` to elide parts of extra-long lines.

In cases where the width isn't known (such as not when used on a tty, or with mintty), then cargo does not pass the flag and the default of 140 is still used.

At this time there is no way for the user to override the width (unlike with the progress bar width). That can be added in the future if there is demand. https://github.com/rust-lang/rust/issues/84673#issuecomment-1179096971 contains some thoughts on some different ideas.

Closes https://github.com/rust-lang/rust/issues/84673
2022-12-19 22:00:52 +00:00
Eric Huss 1709f0aee2 Stabilize terminal-width 2022-12-19 12:17:52 -08:00
bors 9cb39418a5 Auto merge of #11501 - weihanglo:stable-hash-source-id, r=ehuss
Make sure that hash of `SourceId` is stable
2022-12-19 20:00:37 +00:00
bors 3f6c685285 Auto merge of #11477 - kylematsuda:workspace_lockfile, r=weihanglo
Use workspace lockfile when running `cargo package` and `cargo publish`

### What does this PR try to resolve?

Fix #11148.

### How should we test and review this PR?

Please run the integration test in `tests/testsuite/publish_lockfile.rs` or try the steps from the issue.
2022-12-19 18:16:27 +00:00
Kyle Matsuda 8c4f27fd5b make test clearer 2022-12-19 10:50:55 -07:00
Weihang Lo 2179665f67
Ensure hash and stable_hash of SourceId are stable 2022-12-19 16:40:01 +00:00
Weihang Lo a803a754eb
Move `test_cratesio_hash` into test mod 2022-12-19 15:43:47 +00:00
bors 6ab160b8f6 Auto merge of #11473 - hi-rustin:rustin-patch-help, r=epage
Show `--help` if there is no man page for subcommand
2022-12-19 14:08:39 +00:00
hi-rustin 53fd815522 Remove update help for config subcommand
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-12-19 19:08:35 +08:00
hi-rustin b514b1313c Show --help if there is no man page for subcommand
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2022-12-19 19:08:18 +08:00
Will Crichton 818debbf90 Don't scrape examples from library targets by default 2022-12-18 22:15:08 -08:00
bors c994a4a638 Auto merge of #11497 - willcrichton:fix-issue-11496, r=weihanglo
Fix examples of proc-macro crates being scraped for examples

This PR fixes #11496, where examples in proc-macro crates would crash the build with `-Zrustdoc-scrape-examples`. The fix is to change `unit_needs_doc_scrape` to check if a unit is coming from a `proc-macro` package. I added a test to ensure the simple example passes. I also ensured that [automod](https://github.com/dtolnay/automod) also documents correctly.

r? `@weihanglo`
2022-12-18 21:50:58 +00:00
bors 9f4efa5aef Auto merge of #11498 - dtolnay-contrib:relabel, r=ehuss
Enable triagebot's relabel functionality

### What does this PR try to resolve?

This fixes the following failure that rustbot currently posts whenever someone tries to use "<b>`@</b><b>rustbot</b>` label" in this repository.

> **Error**: The feature `relabel` is not enabled in this repository.
> To enable it add its section in the `triagebot.toml` in the root of the repository.

Unauthenticated relabel has been enabled in rust-lang/rust for nearly 4 years. People overwhelmingly use it in good faith.

<br>

### How should we test and review this PR?

Compare against https://github.com/rust-lang/rust/blob/1.66.0/triagebot.toml.

Also skim through the 7 pages of labels on https://github.com/rust-lang/cargo/labels, whether it makes sense the ones I decided to allow arbitrary GitHub users to apply.

<br>

### Additional information

Attempted uses of "<b>`@</b><b>rustbot</b>` label", that failed, but this PR would allow:

- https://github.com/rust-lang/cargo/pull/10343#issuecomment-1200345112
- https://github.com/rust-lang/cargo/pull/10243#issuecomment-1013842215
- https://github.com/rust-lang/cargo/pull/9982#issuecomment-952099226
- https://github.com/rust-lang/cargo/pull/9128#issuecomment-778806343
- https://github.com/rust-lang/cargo/pull/9067#issuecomment-759082349
- https://github.com/rust-lang/cargo/pull/8441#issuecomment-724064074
- https://github.com/rust-lang/cargo/issues/11432#issuecomment-1328715596
- https://github.com/rust-lang/cargo/issues/8841#issuecomment-723649692
- https://github.com/rust-lang/cargo/issues/10820#issuecomment-1176533061
- https://github.com/rust-lang/cargo/issues/10572#issuecomment-1101419326
- https://github.com/rust-lang/cargo/issues/9114#issuecomment-770212444
- https://github.com/rust-lang/cargo/issues/8980#issuecomment-745963184
- https://github.com/rust-lang/cargo/issues/9064#issuecomment-758120957
- https://github.com/rust-lang/cargo/issues/8726#issuecomment-697074328
- https://github.com/rust-lang/cargo/issues/8089#issuecomment-611213914
2022-12-18 20:21:01 +00:00
David Tolnay a41b599e60
Enable triagebot's relabel functionality 2022-12-18 11:27:00 -08:00
Will Crichton d588298c3f Fix examples of proc-macro crates being scraped for examples 2022-12-18 10:41:21 -08:00
bors e517d5a839 Auto merge of #11495 - weihanglo:revert-11419, r=ehuss
Revert "temporarily disable test `lto::test_profile`"

This reverts commit d5cac16d07. The broken change in rustc has been reverted.
2022-12-18 00:15:42 +00:00
Weihang Lo 0523f42cc2
Revert "temporarily disable test `lto::test_profile`"
This reverts commit d5cac16d07.
2022-12-17 22:51:57 +00:00
bors c7fb75640a Auto merge of #11493 - weihanglo:version-bump, r=epage
Bump to 0.69.0, update changelog
2022-12-17 02:26:45 +00:00
Weihang Lo 9520d703ec
Update changelog for 1.68 2022-12-17 02:02:32 +00:00
Weihang Lo cab4ae0d44
Update changelog for 1.67 2022-12-17 02:02:18 +00:00
Weihang Lo 65827de784
Bump to 0.69.0 2022-12-17 00:21:01 +00:00
bors 47860645b4 Auto merge of #11491 - julien-me:julien-fix-typo, r=epage
Fix typo

#### What does this PR try to resolve?

Simple typo in the comments.
2022-12-16 21:40:09 +00:00
Julien Merzoug Cosnuau 4db4a13662 Fix typo 2022-12-16 22:02:41 +01:00
bors 4534dd67bf Auto merge of #11488 - ehuss:ci-dump-cpu, r=weihanglo
Display CPU info in CI

This displays the CPU information on the CI runners in the logs. This can be helpful for diagnosing CI issues and to better understand the environment they are running under.
2022-12-16 15:51:36 +00:00
bors ead8cbd11d Auto merge of #11489 - ehuss:collision-test, r=epage
Fix collision_doc_profile test error

This fixes the `collision_doc_profile` test which was sporadically failing on CI. My theory is that the first `common` build finishes quickly (or the other job slot is delayed). The proc-macro `pm` starts (likely very quickly due to pipelining), and it can jump ahead before the second `common` build starts (or at least before the `Message::Run` message gets delivered).

The order isn't really important or relevant to this test (all that matters is that "common" shows up twice), so this ignores the order of the messages.

cc #11334
2022-12-16 14:44:04 +00:00
Eric Huss b1bcc9c834 Fix collision_doc_profile test error 2022-12-15 20:04:50 -08:00
Eric Huss a371b1a6f4 Display CPU info in CI 2022-12-15 19:35:24 -08:00
bors 8607003bc2 Auto merge of #11399 - Muscraft:autofix-for-clippy, r=weihanglo
fix: Make auto-fix note work with `clippy`

[Someone pointed out](https://github.com/rust-lang/cargo/issues/10976#issuecomment-1307538134) that the suggestion to run `cargo --fix` did not work properly for `cargo clippy`. This makes sure the correct command to run is output when running under `cargo clippy`.

This is done by checking if the `RUSTC_WORKSPACE_WRAPPER` environment variable is set, since `clippy` [sets this every run](51ec465cc3/src/main.rs (L140)). Since other things can use `RUSTC_WORKSPACE_WRAPPER`, we look for a wrapper named [`clippy-driver`](51ec465cc3/src/main.rs (L120)).

Since `clippy` might not be available everywhere `cargo` is tested, this is tested using a `rustc` wrapper.
2022-12-15 17:05:54 +00:00
Scott Schafer 33c32088fa fix: Make auto-fix note work with `clippy` 2022-12-15 10:54:35 -06:00
bors a56fedcea4 Auto merge of #11483 - philpax:patch-1, r=weihanglo
fix(add): use the possessive in error message

### What does this PR try to resolve?

While using `cargo add` to add some dependencies with features, I noticed this error message didn't use an apostrophe. A really minor issue, but it bugged me 😅
2022-12-15 11:21:15 +00:00
Philpax 249683b456
fix(tests): update to match add change 2022-12-15 09:34:23 +01:00
Philpax 365ca5d28c
fix(add): use the possessive in error message 2022-12-15 19:09:25 +11:00