18717 Commits

Author SHA1 Message Date
bors
ab71ba9b5e Auto merge of #14662 - epage:resolver, r=Eh2406,weihanglo
docs(resolver): Lay groundwork for documenting MSRV-aware logic

### What does this PR try to resolve?

This is prep for document the MSRV-aware resolver (see #14639), in particular
- This give more breathing room for adding this new heuristic to the resolver documentation
- This provides the context for understanding the limitations

In moving documentation, I asked the question "where would I look to find this if I had a question on it".  I tried to balance this by not putting too much formal / technical documentation in more guide-level descriptions.  In particular, while "Specifying Dependencies" is in the reference, its also written in somewhat of a guide-style.

There is likely more work that can be done, including
- Maybe making the "SemVer Compatibility" chapter the de facto reference for Cargo's version of semver that other sections reference for a more exhaustive description.
- Splitting discussion of the Feature resolver out of the resolver and features documentation.  In the current implementation, we have 3 resolve phases (1) lockfile, (2) adapt to the current compilation, (3) resolve features.  The last two really serve the same role and I'd consider merging discussion of them.

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

I tried to break up changes in smaller to digest chunks.  This means some times a new section doesn't fully jive with another section until a follow up commit.  I'd recommend reviewing by commit while having the full diff up on the side to see if a concern is still relevant.

### Additional information
2024-10-10 22:30:18 +00:00
bors
a4600184b8 Auto merge of #14668 - dacianpascu06:bump, r=epage
chore(deps): update rust crate pulldown-cmark to 0.12.0

### What does this PR try to resolve?

Closes #14667

### How should we test and review this PR?
Cargo build-man stopped giving errors after updating pulldown-cmark
### Additional information
2024-10-10 20:27:06 +00:00
bors
7aa7fb1e2f Auto merge of #14663 - x-hgg-x:resolver-perf, r=Eh2406
Improve resolver speed

### What does this PR try to resolve?

This PR improves the resolver speed after investigations from https://github.com/Eh2406/pubgrub-crates-benchmark/issues/6.

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

Commit 1 adds a test showing a slow case in the resolver, where resolving time is cubic over the number of versions of a crate. It can be used for benchmarking the resolver.

Comparison of the resolving time with various values of `N=LAST_CRATE_VERSION_COUNT` and `C=TRANSITIVE_CRATES_COUNT`:

|      | N=100 | N=200 | N=400 |
|------|-------|-------|-------|
| C=1  | 0.25s | 0.5s  | 1.4s  |
| C=2  | 7s    | 44s   | 314s  |
| C=3  | 12s   | 77s   | 537s  |
| C=6  | 30s   | 149s  | 1107s |
| C=12 | 99s   | 447s  | 2393s |

Commit 2 replaces the default hasher with the hasher from `rustc-hash`, decreasing resolving time by more than 50%.

Performance comparison with the test from commit 1 by setting `LAST_CRATE_VERSION_COUNT = 100`:
| commit          | duration |
|-----------------|----------|
| master          | 16s      |
| with rustc-hash | 6.7s     |

Firefox profiles, can be read with https://profiler.firefox.com:
[perf.tar.gz](https://github.com/user-attachments/files/17318243/perf.tar.gz)

r? Eh2406
2024-10-10 19:55:33 +00:00
dacian
54bbe02489 chore(deps): update rust crate pulldown-cmark to 0.12.0 2024-10-10 22:38:01 +03:00
x-hgg-x
3d4d48b0ff fix: use rustc-hash in the resolver 2024-10-10 20:06:31 +02:00
x-hgg-x
2579ec3d08 test: add a test showing a slow case in the resolver 2024-10-10 20:06:30 +02:00
Ed Page
0d072e10a0 docs(resolver): Split SemVer section into individual resolver pieces
We talked about three different roles of versions within the resolver in
a way that made it easy to miss some of them.
2024-10-09 13:30:37 -05:00
Ed Page
16dbce1f4d docs(resolver): Move Constraints context under new Constraints header 2024-10-09 11:32:10 -05:00
Ed Page
f147d529f5 docs(resolver): Move all constraints under one header 2024-10-09 11:30:24 -05:00
Ed Page
8e872ac0f2 docs(resolver): Describe how the resolver works
This is to provide better context for the sections that come after.
2024-10-09 11:27:29 -05:00
bors
15fbd2f607 Auto merge of #14137 - Xaeroxe:checksum-freshness, r=weihanglo
initial version of checksum based freshness

Implementation for https://github.com/rust-lang/cargo/issues/14136 and resolves https://github.com/rust-lang/cargo/issues/6529

This PR implements the use of checksums in cargo fingerprints as an alternative to using mtimes. This is most useful on systems with poor mtime implementations.

This has a dependency on https://github.com/rust-lang/rust/pull/126930. It's expected this will increase the time it takes to declare a build to be fresh. Still this loss in performance may be preferable to the issues the ecosystem has had with the use of mtimes for determining freshness.
2024-10-08 21:08:11 +00:00
Ed Page
940e82cba3 docs(deps): Add pre-release explanation from Resolver docs
This will let the dependency resolution docs better focus.
2024-10-08 15:59:17 -05:00
Ed Page
b95fcc2840 docs(deps): Add metadata explanation from Resolver docs
I'm able to shrink / better focus the text as most of the content is
covered by the version field.
2024-10-08 15:49:11 -05:00
Ed Page
608314625a docs(resolver): Instead of refreshing user on version req syntax, show expanded
Trying to encourage having places that "own" a concept and letting other areas
better focus.
2024-10-08 15:49:11 -05:00
Ed Page
066721428f docs(manifest): Remove bad SemVer guidance
This implied SemVer's pre-1.0.0 rules,
rather than Cargo's modified SemVer policy.

The distinction between "minor" and "patch" is
[muddy](https://epage.github.io/blog/2022/02/minor-semver-issue/),
so leaving that for the more detailed documentation to cover.

This also dramatically simplifies the section.
2024-10-08 15:49:11 -05:00
Ed Page
c64a063fad docs(manifest): Describe version syntax
This is modeled off of `resolver.md` and is prep for moving it to other
places.
2024-10-08 15:42:05 -05:00
Jacob Kiesel
cf893c1695
test(freshness_checksum): verify cargo depinfo is properly encoded 2024-10-08 16:30:54 -04:00
Jacob Kiesel
c0e550ee5b
test(freshness_checksum): different fingeprint methods are compatible
This ensures that users can switch between different fingerprint
freshness methods and still correctly rebuild stuff.
2024-10-08 16:29:46 -04:00
Jacob Kiesel
0d08e19661
test(freshness_checksum): verify unstable flag is gated correctly 2024-10-08 16:29:45 -04:00
Weihang Lo
66998ea24a
test(freshness_checksum): verify checksum works
Two new tests:

* checksum_actually_uses_checksum: chekcsum works when mtime forwards
* same_size_different_content: checksum does check content
2024-10-08 16:29:45 -04:00
Weihang Lo
b48fe7354f
test(freshness_checksum): remove unnecessary sleep
We don't rely on mtime anymore for checksum-based fingerprint
2024-10-08 16:29:45 -04:00
Weihang Lo
74cc1deb51
test(freshness_checksum): enable -Zfreshness-checksum
These tests are modified or renamed to reflect the switch to
checksum fingerprint:

* bust_patched_dep
* modifying_and_moving
* rebuild_on_mid_build_file_modification
* rebuild_sub_package_then_while_package
* skip_mtime_check_in_selected_cargo_home_subdirs
* use_mtime_cache_in_cargo_home
2024-10-08 16:29:45 -04:00
Weihang Lo
e5a44e24a1
test(freshness_checksum): requires nightly rustc 2024-10-08 16:29:45 -04:00
Weihang Lo
eea5fe9b00
test(freshness_checksum): remove unnecessary tests
* cargo_env_changes
* fingerprint_cleaner_does_not_rebuild
* modify_only_some_files
* rebuild_if_build_artifacts_move_forward_in_time
* simulated_docker_deps_stay_cached
* update_dependency_mtime_does_not_rebuild
2024-10-08 16:29:45 -04:00
Weihang Lo
9b17115534
test(freshness_checksum): update test module description 2024-10-08 16:29:45 -04:00
Weihang Lo
ad7d33d893
test: copy freshness tests in preparation of checksum tests 2024-10-08 16:29:44 -04:00
Jacob Kiesel
b9420f87cf
Add appropriate documentation 2024-10-08 16:29:44 -04:00
Jacob Kiesel
0d2e8a5619
add bsd 2 clause to allow list for blake3 dep arrayref 2024-10-08 16:29:44 -04:00
Jacob Kiesel
f4ca739073
implement checksum freshness fingerprints for cargo 2024-10-08 16:29:44 -04:00
Ed Page
5d45b31cda docs(deps): Shift default version req explainer to new section 2024-10-08 14:57:39 -05:00
Ed Page
57b5f18764 docs(deps): Split out dedicated default requirement section 2024-10-08 14:57:36 -05:00
Ed Page
721e2cd669 docs(deps): Remove redundant version req recommendation
At the end of this section, we say the same but add a lot more context.
2024-10-08 14:57:28 -05:00
Ed Page
24d32311f2 docs(ref): Group all dep chapters 2024-10-08 11:57:44 -05:00
bors
ac39e69a0f Auto merge of #14656 - shannmu:_cargo_publish_registry_completer, r=epage
feat: Add custom completer for completing registry name

### What does this PR try to resolve?
Tracking issue https://github.com/rust-lang/cargo/issues/14520

Add custom completer for completing `cargo publish --registry <TAB>` and `cargo add --registry <TAB>`.
2024-10-08 16:42:13 +00:00
bors
42a774bb8a Auto merge of #14657 - ehuss:deprecate-build-plan, r=epage
Document build-plan as being deprecated

This adds a note to the build-plan documentation that it is deprecated. I do not think it will make any progress as it is. In the future, we should remove the feature (#7902), possibly with a code-warning ahead of time.
2024-10-08 16:07:10 +00:00
Eric Huss
bc2eba1333 Document build-plan as being deprecated 2024-10-08 08:57:17 -07:00
shannmu
245cba27db feat: Add custom completer for completing registry name 2024-10-08 23:50:00 +08:00
bors
9026f9565c Auto merge of #14653 - epage:complete, r=ehuss
fix(complete): Don't complete files for any value

### What does this PR try to resolve?
We now need to opt-in to path completions for values, which can be as simple as setting the value parser to be for `PathBuf`s.

We'll now show a lot less irrelevant completions.

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

### Additional information
2024-10-08 15:35:41 +00:00
bors
aea3404eae Auto merge of #14614 - x-hgg-x:more-sat-resolver-tests, r=Eh2406
Add more SAT resolver tests

### What does this PR try to resolve?

This is a follow-up of #14583.

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

* Commit 1 splits tests into smaller modules.
* Commit 2 adds more helper trait methods.
* Commit 3 refactors computation of the SAT clauses, by introducing intermediate boolean variables for each dependency and each dependency feature declared in a package.
The old behavior was incorrect: package features specified in an optional dependency were activated if the package was activated, even if the dependency wasn't activated.
* Commit 4 add tests from https://github.com/Eh2406/pubgrub-crates-benchmark/tree/main/out/index_ron.

r? Eh2406
2024-10-08 14:25:42 +00:00
bors
fbcd9bb571 Auto merge of #14464 - linyihai:issue-14194, r=weihanglo
fix: avoid inserting duplicate `dylib_path_envvar` when calling `cargo run` recursively

### What does this PR try to resolve?

If the current program started by `cargo run` recursively call into `cargo run`, the second `cargo run` will insert  `search_path`  into `dylib_path_envvar` again.

Fixes #14194

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

The first commit adds the test to reflect the issue. The first call to `cargo run` stores the dylib search path env var to a file. Subsequent calls verify that env var remains the same.

The second commit fixes the behavior by checking if env vars in `search_path` are a prefix of the slice of env vars in `dylib_path_envvar`.
2024-10-08 12:51:33 +00:00
Lin Yihai
54dbc2bf66 fix: Avoid inserting search_path again. 2024-10-08 16:20:21 +08:00
Lin Yihai
e888c1306f test: Add test for issue-14194 2024-10-08 16:16:25 +08:00
x-hgg-x
dedf251c27 test: add tests from pubgrub 2024-10-08 08:06:15 +02:00
x-hgg-x
870f6d31d7 test: refactor sat resolver clauses computation
Add new intermediate boolean variables for each dependency and each dependency feature declared in a package.
This is used to simplify computation of the sat clauses.

Add support for multiple dependencies with the same name, if their kind or target is different.

A non-weak dependency feature for an optional dependency now activates a feature of the same name in the sat resolver.
2024-10-08 08:04:43 +02:00
x-hgg-x
04e4270758 test: add more resolver helper methods 2024-10-08 08:04:43 +02:00
x-hgg-x
cc4c3e784a test: separate resolver tests into multiple files 2024-10-08 08:04:43 +02:00
Ed Page
244578e9e2 fix(complete): Don't complete files for any value
We now need to opt-in to path completions for values, which can be as
simple as setting the value parser to be for `PathBuf`s.

We'll now show a lot less irrelevant completions.
2024-10-07 21:01:03 -05:00
bors
2e309bd754 Auto merge of #14489 - rust-lang:dependabot/cargo/gix-path-0.10.10, r=weihanglo
chore(deps): bump gix-path from 0.10.9 to 0.10.11

Bumps [gix-path](https://github.com/Byron/gitoxide) from 0.10.9 to 0.10.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/Byron/gitoxide/releases">gix-path's releases</a>.</em></p>
<blockquote>
<h2>gix-path v0.10.10</h2>
<p>A maintenance release without user-facing changes.</p>
<h3>Commit Statistics</h3>
<ul>
<li>6 commits contributed to the release over the course of 12 calendar days.</li>
<li>35 days passed between releases.</li>
<li>0 commits were understood as <a href="https://www.conventionalcommits.org">conventional</a>.</li>
<li>0 issues like '(#ID)' were seen in commit messages</li>
</ul>
<h3>Commit Details</h3>
<!-- raw HTML omitted -->
<!-- raw HTML omitted -->
<ul>
<li><strong>Uncategorized</strong>
<ul>
<li>Prepare changelogs prior to release (0f25841)</li>
<li>Merge pull request <a href="https://redirect.github.com/Byron/gitoxide/issues/1523">#1523</a> from martinvonz/push-xmsuurxprnnw (83c9de0)</li>
<li>Remove <code>--system</code> from <code>git config</code> call as it fails on MacOS (6b1c243)</li>
<li>Run <code>git config -l</code> in temp dir when looking up system config (20ef4e9)</li>
<li>Merge branch 'push-ysnqkzlzwuwq' (e2c747d)</li>
<li>Don't show console on Windows (087594c)</li>
</ul>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="d19af16e1d"><code>d19af16</code></a> Release gix-date v0.9.0, gix-actor v0.31.6, gix-validate v0.9.0, gix-object v...</li>
<li><a href="0f2584178a"><code>0f25841</code></a> prepare changelogs prior to release</li>
<li><a href="9ed2b24e5d"><code>9ed2b24</code></a> Merge branch 'improvements'</li>
<li><a href="6990afd269"><code>6990afd</code></a> fix: similarity detection</li>
<li><a href="f8c5d9ce87"><code>f8c5d9c</code></a> fix similarity detection</li>
<li><a href="25a3f1b0b0"><code>25a3f1b</code></a> Merge pull request <a href="https://redirect.github.com/Byron/gitoxide/issues/1531">#1531</a> from EliahKagan/progress-typos</li>
<li><a href="ba72ee0f06"><code>ba72ee0</code></a> fix!: better peeling performance for reference traversal.</li>
<li><a href="9f9feb6545"><code>9f9feb6</code></a> add progress report for July</li>
<li><a href="b31d6b79fd"><code>b31d6b7</code></a> Fix typos in config support info</li>
<li><a href="242fedc973"><code>242fedc</code></a> Merge branch 'improvements'</li>
<li>Additional commits viewable in <a href="https://github.com/Byron/gitoxide/compare/gix-path-v0.10.9...gix-path-v0.10.10">compare view</a></li>
</ul>
</details>
<br />

[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=gix-path&package-manager=cargo&previous-version=0.10.9&new-version=0.10.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/rust-lang/cargo/network/alerts).

</details>

> **Note**
> Automatic rebases have been disabled on this pull request as it has been open for over 30 days.
2024-10-08 00:07:37 +00:00
dependabot[bot]
7a58e6fbd0
chore(deps): bump gix-path from 0.10.9 to 0.10.11
Bumps [gix-path](https://github.com/Byron/gitoxide) from 0.10.9 to 0.10.11.
- [Release notes](https://github.com/Byron/gitoxide/releases)
- [Changelog](https://github.com/Byron/gitoxide/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Byron/gitoxide/compare/gix-path-v0.10.9...gix-path-v0.10.11)

---
updated-dependencies:
- dependency-name: gix-path
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 19:24:32 -04:00
bors
ab361f24a3 Auto merge of #14647 - elchukc:refactor_pkg_activated_features, r=weihanglo
improve error reporting when feature not found in `activated_features`

Pulls the error message refactor out of #14593 (originally #13207) to improve error reporting when we fail to get the list of activated features enabled for the given package. It now fully lists the activated_features hashmap keys too.

From the [original author](https://github.com/rust-lang/cargo/pull/13207#issue-2056019109):

> I moved `activated_features_int` into `activated_features` and `activated_features_unverified` as I was concerned of the performance cost of generating the full error when its not a fatal error and may occur many times.

Old vs new error message:
```diff
- activated_features for invalid package: features did not find PackageId { name: "bindep", version: "0.0.0", source: "[ROOT]/foo/bindep" } NormalOrDev
+ did not find features for (PackageId { name: "bindep", version: "0.0.0", source: "[ROOT]/foo/bindep" }, NormalOrDev) within activated_features:
+ [
+     (
+         PackageId {
+             name: "bindep",
+             version: "0.0.0",
+             source: "[ROOT]/foo/bindep",
+         },
+         ArtifactDep(
+             CompileTarget {
+                 name: "[ALT_TARGET]",
+             },
+         ),
+     ),
+     (
+         PackageId {
+             name: "foo",
+             version: "0.0.0",
+             source: "[ROOT]/foo",
+         },
+         NormalOrDev,
+     ),
+ ]
```
r? weihanglo
2024-10-05 21:29:43 +00:00