18124 Commits

Author SHA1 Message Date
Weihang Lo
12d00dcf6f
chore(ci): cargo-semver-checks to 0.32.0 2024-07-15 20:24:48 -04:00
Weihang Lo
33c75e66ef
doc: replace deprecated output.html.curly-quotes 2024-07-15 20:24:48 -04:00
Weihang Lo
00da161ce8
chore(ci): mdbook to 0.4.40 2024-07-15 20:20:20 -04:00
bors
7b227dee2c Auto merge of #14214 - eth3lbert:snapbox-fetch-n-la, r=weihanglo
test: migrate fetch and list_availables to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/fetch.rs`
- `tests/testsuite/list_availables.rs`
2024-07-15 20:18:29 +00:00
bors
54ee7e3257 Auto merge of #14254 - weihanglo:jobserver, r=epage
chore: downgrade to jobserver@0.1.28

See https://github.com/rust-lang/jobserver-rs/issues/99

While there is a fix waiting for review,
we might miss the release window for 1.80,
so propose we beta-backport this
2024-07-15 19:45:44 +00:00
Weihang Lo
8923ba62dd
chore: downgrade to jobserver@0.1.28
See https://github.com/rust-lang/jobserver-rs/issues/99

While there is a fix waiting for review,
we might miss the release window for 1.80,
so propose we beta-backport this
2024-07-15 14:28:54 -04:00
bors
a2d45dc370 Auto merge of #14252 - epage:du-less, r=ehuss
perf(source): Don't `du` on every git source load

### What does this PR try to resolve?

When profiling Zed (#14238), a major factor in their no-op run times is git patches and git dependencies.  The slowest operation for each git source is running `du`.  This is extraneous for a couple of reasons
- GC isn't stable, slowing people down for a feature they aren't using
- Size tracking was expected to be lazy, only reading sizes when the GC is configured for size, while this was eager
- Git checkouts are immutable but we check on every load
- This optimized for "while filesystem caches are warm" from a checkout operation when checkout operations are rare compared to all of the other commands run on a working directory.

This removes the `du`, relying on the lazy loading that happens in `update_null_sizes`.

For Zed, this removed about 40ms total from the runtime.  While by itself, this is below the threshold of being noticed,
- It adds up if any editor integrations are calling `cargo metadata` a lot
- Over time, small gains like this will add up

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

### Additional information

cc `@ehuss`
2024-07-15 17:33:50 +00:00
Ed Page
cd74470c4e perf(source): Don't du on every git source load
When profiling Zed (#14238), a major factor in their no-op run times
is git patches and git dependencies.  The slowest operation for each git
source is running `du`.  This is extraneous for a couple of reasons
- GC isn't stable, slowing people down for a feature they aren't using
- Size tracking was expected to be lazy, only reading sizes when the GC
  is configured for size, while this was eager
- Git checkouts are immutable but we check on every load
- This optimized for "while filesystem caches are warm" from a checkout
  operation when checkout operations are rare compared to all of the other
  commands run on a working directory.

This removes the `du`, relying on the lazy loading that happens in
`update_null_sizes`.
2024-07-15 10:38:28 -05:00
bors
2d658f2a62 Auto merge of #14239 - epage:git, r=weihanglo
fix(source): Don't warn about unreferenced duplicate packages

### What does this PR try to resolve?

This also improves the message, consolidating multiple duplicates and saying which was loaded instead, as it naturally fell out of the design

Fixes #10752

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

### Additional information

We're still subject to #13724 and fully load every manifest, even if we don't use it.  I'm exploring that topic at https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Redundant.20code.20in.20.60GitSouce.60.3F/near/450783427

This change builds on
- #13993
- #14169
- #14231
- #14234
2024-07-15 13:47:38 +00:00
eth3lbert
16a2dbd2ba
refactor(test): make list_availables snapshot-aware 2024-07-14 04:09:34 +08:00
eth3lbert
b43ea97f3b
test: migrate list_availables to snapbox 2024-07-14 04:09:32 +08:00
eth3lbert
7a6bf16153
test: migrate fetch to snapbox 2024-07-14 04:07:54 +08:00
bors
b31577d43c Auto merge of #14243 - epage:prelude, r=weihanglo
feat(test): Add cargo_test to test-support prelude

### What does this PR try to resolve?

With where we are at with #14039, I was revisiting our test writing documentation.  I was wanting to put more emphasis on rustdoc and found it would be helpful to talk about the concepts if a prelude was used instead of `extern crate`.

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

Yes, this included some `use` clean ups in tangentially-related commit but its already painful enough
walking through every test file, I didn't want to do it twice.

### Additional information
2024-07-13 14:00:09 +00:00
bors
916c5a4f36 Auto merge of #14202 - pietroalbini:pa-publish, r=weihanglo
Add workflow to publish Cargo automatically

One of the last manual pieces of the Rust release process is publishing Cargo, and as it happens after the release itself it is often forgotten (I am often guilty of that). This PR aims to fully automate that.

Nowadays tagging Cargo happens automatically, as the release process creates and pushes a signed tag for the release. So the only piece remaining is automatically executing the `publish.py` script. This PR adds a workflow triggered by the tag push to run `publish.py` with a [rust-lang-owner](https://crates.io/users/rust-lang-owner) scoped token.

The secret is stored in the [`release` environment](https://github.com/rust-lang/cargo/settings/environments/3357627654/edit), which can only be used during tag pushes.

cc `@Mark-Simulacrum`
2024-07-13 13:28:54 +00:00
Ed Page
e2e2f311aa docs(contrib): Note reqirement for prelude 2024-07-12 15:57:01 -05:00
Ed Page
5b9799c6f4 refactor: Migrate from extern crate to test-support prelude
We now include the prelude in so many places, this simplifies how we can
present how `cargo-test-support` works.

Yes, this included some `use` clean ups but its already painful enough
walking through every test file, I didn't want to do it twice.
2024-07-12 15:57:00 -05:00
Ed Page
090064cc14 feat(test): Add cargo_test to test-support prelude 2024-07-12 15:56:22 -05:00
bors
67a452bc56 Auto merge of #14245 - eth3lbert:snapbox-implicit-features, r=epage
test: migrate implicit_features to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/implicit_features.rs`
2024-07-12 19:34:11 +00:00
eth3lbert
3d2d234bb9
test: migrate implicit_features to snapbox 2024-07-13 02:30:29 +08:00
bors
8b1d18afce Auto merge of #14241 - eth3lbert:snapbox-build-std, r=epage
test: migrate build-std/main to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/build-std/main.rs`
2024-07-12 04:31:27 +00:00
eth3lbert
04cccfa259
test: migrate build-std/main to snapbox 2024-07-12 11:56:07 +08:00
Ed Page
ed56f1ec14 fix(source): Don't warn about unreferenced duplicate packages
Fixes #10752
2024-07-11 20:30:47 -05:00
Ed Page
3124b0c33a refactor(source): Delay the duplicate name check 2024-07-11 20:30:47 -05:00
Ed Page
58ee635337 fix(source): Consolidate duplicate package warnings 2024-07-11 20:30:10 -05:00
Ed Page
6c0f14c245 fix(source): Make duplicate selection predictable 2024-07-11 20:29:39 -05:00
bors
0e2ef808c8 Auto merge of #14235 - eth3lbert:snapbox-check-cfg, r=epage
test: migrate check_cfg to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/check_cfg.rs`

---

This commit allow deprecation for most of the tests currently in this file. This is because the tests either use `does_not_contain` or perform multiple `contains` assertion for single tool with macro `x!`.

Here are some potential options to further eliminate the deprecation:

  1. Remove the `x!` macro and replace the it with `str![]` for both Windows and non-Windows platforms.
  2. Modify the `x!` macro to only generate the `--check-cfg` part for different platforms and manually compose it with `format!`.
2024-07-12 01:07:43 +00:00
bors
cf38b963ab Auto merge of #14231 - epage:git-clean, r=Muscraft
refactor(source): More RecursivePathSource clean up

### What does this PR try to resolve?

This is a follow up to #13993 and #14169 and is part of my work towards #10752.

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

### Additional information
2024-07-11 21:50:54 +00:00
Ed Page
1a254008e4 test(git): Show unused duplicate package warning 2024-07-11 16:49:33 -05:00
Ed Page
848dd7f1cd refactor(source): Reuse the package hash map
Primary benefit: looking to track more state in `RecursivePathSource`
and this is a stepping stone.

Minor benefits:
- Cleaner
- Avoid re-allocating
- Faster lookup for `download`
2024-07-11 16:48:34 -05:00
Ed Page
526138602a refactor(source): Flatten RecursivePathSource::read_packages_inner 2024-07-11 16:48:34 -05:00
Ed Page
5d43722905 refactor(source): Pull in read_packages
This is tied to the `Source` and only used there.
2024-07-11 16:48:33 -05:00
Ed Page
53e5f2bbca refactor(source): Flatten list_files_walk
This prepares the way for moving `walk` from `read_packages` into here.
2024-07-11 16:46:58 -05:00
Ed Page
7128c76105 refactor(source): Reuse RecursivePathSource loading 2024-07-11 16:46:58 -05:00
bors
8519ad266d Auto merge of #14238 - epage:traces, r=arlosi
Add more profiling traces

### What does this PR try to resolve?

Someone suggested I look at
[zed](https://github.com/zed-industries/zed).
It has some interesting performance characteristics compared to projects I looked at before:
- A lot of workspace members
- git dependencies
- patching with git dependencies

This adds traces that help provide more context for those scenarios when looking at them.

![image](https://github.com/rust-lang/cargo/assets/60961/4bee9a61-e019-477c-af67-6d8a1b1398e9)

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

### Additional information

Some of these areas might be of interest for
optimizing:
- On every invocation, we do a git2 `copy_to` call for each git checkout
- On every invocation, we do a `du` on each git checkout
- It'd be great to avoid parsing every manifest in a git checkout but we need to do a full parse to make sure we find all packages (see https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Redundant.20code.20in.20.60GitSouce.60.3F)
- Its suspicious how much time we spend in the "poison" step of resolving when its a no-op
2024-07-11 20:58:41 +00:00
Ed Page
89eb406e47 Add more profiling traces
Someone suggested I look at
[zed](https://github.com/zed-industries/zed).
It has some interesting performance characteristics compared to projects
I looked at before:
- A lot of workspace members
- git dependencies
- patches

This adds traces that help provide more context for those scenarios when
looking at them.

Some of these areas might be of interest for
optimizing:
- On every invocation, we do a git2 `copy_to` call for each git checkout
- On every invocation, we do a `du` on each git checkout
- It'd be great to avoid parsing every manifest in a git checkout but we
  need to do a full parse to make sure we find all packages (see
  https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Redundant.20code.20in.20.60GitSouce.60.3F)
- Its suspicious how much time we spend in the "poison" step of
  resolving when its a no-op
2024-07-11 13:18:25 -05:00
bors
e55aad081b Auto merge of #14234 - epage:bad-path, r=weihanglo
fix(overrides): Don't warn on duplicate packages from using '..'

### What does this PR try to resolve?

As part of #10752, I was changing the "duplicate package" warning to be like:
```
[WARNING] skipping duplicate package `a2 v0.5.0 ([ROOT]/foo/b/../a)`:
  [ROOT]/foo/b/../a/a2/Cargo.toml
in favor of [ROOT]/foo/a/a2/Cargo.toml
```
and it showed that we were considering two paths to the same package to be duplicates.

This suppresses that warning.

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

### Additional information
2024-07-11 15:00:12 +00:00
eth3lbert
5a09fcb9f4
test: migrate check_cfg to snapbox 2024-07-11 09:38:57 +08:00
bors
0d67af02c9 Auto merge of #14233 - epage:elapsed, r=weihanglo
fix(test): Redact elapsed time in the minutes time frame

### What does this PR try to resolve?

This came up in #14231
```
---- expected: tests/testsuite/lto.rs:611:27
++++ actual:   stderr
   1    1 | [FRESH] registry-shared v0.0.1
   2    2 | [FRESH] registry v0.0.1
   3    3 | [COMPILING] bar v0.0.0 ([ROOT]/foo/bar)
   4    4 | [RUNNING] `rustc --crate-name bar [..]-C lto [..]--test [..]`
   5    5 | [RUNNING] `rustc --crate-name b [..]-C lto [..]--test [..]`
   6      - [FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
   7    6 | [RUNNING] `[ROOT]/foo/target/release/deps/bar-[HASH][EXE]`
   8    7 | [RUNNING] `[ROOT]/foo/target/release/deps/b-[HASH][EXE]`
   9    8 | [DOCTEST] bar
  10    9 | [RUNNING] `rustdoc --edition=2015 --crate-type cdylib --crate-type rlib --crate-name bar --test [..]-C lto [..]
       10 + [FINISHED] `release` profile [optimized] target(s) in 1m 00s

Update with SNAPSHOTS=overwrite
```

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

### Additional information
2024-07-10 22:25:11 +00:00
Ed Page
3dd0173850 fix(overrides): Don't warn on duplicate packages from using '..'
I was changing the "duplicate package" warning to be like:
```
[WARNING] skipping duplicate package `a2 v0.5.0 ([ROOT]/foo/b/../a)`:
  [ROOT]/foo/b/../a/a2/Cargo.toml
in favor of [ROOT]/foo/a/a2/Cargo.toml
```
and it showed that we were considering two paths to the same package to
be duplicates.

This suppresses that warning.
2024-07-10 17:06:22 -05:00
Ed Page
7fcd580b3b fix(test): Redact elapsed time in the minutes time frame
This came up in #14231
```
---- expected: tests/testsuite/lto.rs:611:27
++++ actual:   stderr
   1    1 | [FRESH] registry-shared v0.0.1
   2    2 | [FRESH] registry v0.0.1
   3    3 | [COMPILING] bar v0.0.0 ([ROOT]/foo/bar)
   4    4 | [RUNNING] `rustc --crate-name bar [..]-C lto [..]--test [..]`
   5    5 | [RUNNING] `rustc --crate-name b [..]-C lto [..]--test [..]`
   6      - [FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
   7    6 | [RUNNING] `[ROOT]/foo/target/release/deps/bar-[HASH][EXE]`
   8    7 | [RUNNING] `[ROOT]/foo/target/release/deps/b-[HASH][EXE]`
   9    8 | [DOCTEST] bar
  10    9 | [RUNNING] `rustdoc --edition=2015 --crate-type cdylib --crate-type rlib --crate-name bar --test [..]-C lto [..]
       10 + [FINISHED] `release` profile [optimized] target(s) in 1m 00s

Update with SNAPSHOTS=overwrite
```
2024-07-10 16:42:21 -05:00
Ed Page
5ed63926d3 test(test): Verify elapsed redaction 2024-07-10 16:40:47 -05:00
Ed Page
a10b3ca8b2 refactor(test): Split out 'pure' redactions for testing 2024-07-10 16:37:12 -05:00
Ed Page
c8113d3a1c refactor(test): Move compare tests into a mod 2024-07-10 16:33:14 -05:00
bors
17b52b0ca1 Auto merge of #14209 - dieterplex:migrate-lto-snapbox, r=weihanglo
test: Migrate lto tests to snapbox

Part of #14039.
2024-07-10 18:54:04 +00:00
bors
fd2b60ea01 Auto merge of #14221 - epage:implicit, r=weihanglo
fix: Ensure dep/feature activates the dependency on 2024

### What does this PR try to resolve?

Fixes #14016

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

This doesn't revert the last commit of #14018 so that it works properly
on Editions 2021 and 2024.

### Additional information
2024-07-10 18:23:50 +00:00
bors
edd8703a0d Auto merge of #14228 - yukionfire:patch001, r=arlosi
chore(docs): update index of reference

add missing section in the index page of reference
2024-07-10 15:38:32 +00:00
bors
4e19f315c9 Auto merge of #14226 - eth3lbert:snapbox-test, r=epage
test: migrate test to snapbox

### What does this PR try to resolve?

Part of https://github.com/rust-lang/cargo/issues/14039.

Migrate following to snapbox:

- `tests/testsuite/test.rs`
2024-07-10 13:54:08 +00:00
bors
7c8a52444f Auto merge of #14229 - tianyeyouyou:chore, r=epage
chore: remove duplicate words

remove duplicate words to enhance readability.
2024-07-10 12:56:51 +00:00
tianyeyouyou
87084c176b remove duplicate words 2024-07-10 20:51:45 +08:00
yukionfire
8b3dcddaad update index of reference 2024-07-10 20:04:35 +08:00