17594 Commits

Author SHA1 Message Date
renovate[bot]
a2e32f2493
chore(deps): update alpine docker tag to v3.20 2024-06-01 00:52:26 +00:00
bors
7a6fad0984 Auto merge of #13992 - epage:config, r=weihanglo
fix(config): Ensure `--config net.git-fetch-with-cli=true` is respected

### What does this PR try to resolve?

#13479 changed the global context initialization order so that command line stuff is processed after we read some config.
This had a side effect of breaking `--config net.git-fetch-with-cli=true`.
I reverted the change to restore support for `--config`.

Fixes #13991

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

### Additional information

This reverts commit f525e1f383.

This removes color control from warnings for unstable features.
For some reason this removed color support from `cargo -Zhelp` in the
tests but I can't reproduce it locally.

The most important thing was getting the config fix in.
There are two follow ups
- Can we have the config working *and* color?
- Why did this fail for this field and not the others we already had
  tests for?

I ran out my immediate time box for looking into these.
2024-05-31 22:26:03 +00:00
Ed Page
4ce2b61f2a Revert "fix(context): Configure Shell before emitting messages"
This reverts commit f525e1f383fc0d0a7adbdfb1bac6d6228ae79b33.

This removes color control from warnings for unstable features.
For some reason this removed color support from `cargo -Zhelp` in the
tests but I can't reproduce it locally.

The most important thing was getting the config fix in.
There are two follow ups
- Can we have the config working *and* color?
- Why did this fail for this field and not the others we already had
  tests for?

I ran out my immediate time box for looking into these.

Fixes #13991
2024-05-31 14:56:18 -05:00
Ed Page
c0a79574ef test(config): Show current git-fetch-with-cli behavior 2024-05-31 14:56:12 -05:00
bors
9ba3894b16 Auto merge of #13990 - riley-williams:doc-outdated-libcurl-url, r=epage
Fix libcurl proxy documentation link

### What does this PR try to resolve?

Fixes a broken link to the libcurl proxy documentation by updating it with new location.
2024-05-31 17:27:05 +00:00
Riley Williams
0bdfae1c43
Update url to new libcurl proxy doc location 2024-05-31 12:58:50 -04:00
bors
d04355a8c4 Auto merge of #13987 - epage:new, r=ehuss
fix(new): Dont say were adding to a workspace when a regular package is in root

Fixes #13985
2024-05-31 16:39:32 +00:00
bors
ef56deb268 Auto merge of #13970 - weihanglo:libgit2@1.8.0, r=ehuss
fix: adjust custom err from cert-check due to libgit2 1.8 change
2024-05-31 15:33:28 +00:00
bors
4a86f6f34d Auto merge of #13989 - epage:target-sort, r=weihanglo
fix(toml): Ensure targets are in a deterministic order

### What does this PR try to resolve?

With #13713, we enumerate all targets in `Cargo.toml` on `cargo publish` and `cargo vendor`.
However, the order of the targets is non-determistic. This can be annoying for comparing the published `Cargo.toml` across releases but even worse is the churn it causes for `cargo vendor`.

So we sort all the targets during publish.
This keeps costs minimal with the following risks
- If the non-determinism shows up in a way that affects developers during development
- If there is a reason the user wants to control target order for explicit targets

Fixes #13988

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

As for writing of tests, I'm unsure why none of our existing tests failed which makes it unclear to me what would be needed to write a test for this.

### Additional information
2024-05-31 15:02:05 +00:00
Ed Page
40b9fec255 fix(toml): Ensure targets are in a deterministic order
With #13713, we enumerate all targets in `Cargo.toml` on `cargo publish`
and `cargo vendor`.
However, the order of the targets is non-determistic.
This can be annoying for comparing the published `Cargo.toml` across releases but even
worse is the churn it causes for `cargo vendor`.

So we sort all the targets during publish.
This keeps costs minimal with the following risks
- If the non-determinism shows up in a way that affects developers
  during development
- If there is a reason the user wants to control target order for
  explicit targets

Fixes #13988
2024-05-31 09:18:57 -05:00
Weihang Lo
0978162ebe
fix: adjust custom err from cert-check due to libgit2 1.8 change
libgit2 disallows overriding errors from certificate check since v1.8.0,
so we store the error additionally and unwrap it later.

See 9a9f220119
2024-05-31 00:39:30 -04:00
Ed Page
26c1678ad2 fix(new): Dont say were adding to a workspace when a regular package is in root
Fixes #13985
2024-05-30 13:27:12 -05:00
bors
94aa7fb132 Auto merge of #13984 - weihanglo:cargo-package, r=epage
doc(cargo-package): explain no guarantee of vcs provenance
2024-05-30 15:11:52 +00:00
Weihang Lo
22185e14fa
doc(cargo-package): explain no guarantee of vcs provenance 2024-05-30 09:46:23 -04:00
bors
0b72605141 Auto merge of #13982 - VitalikButerinEth:master, r=hi-rustin
chore: fix some comments
2024-05-30 12:50:08 +00:00
VitalikButerinEth
d3e05d588e chore: fix some comments
Signed-off-by: VitalikButerinEth <csyingyu@126.com>
2024-05-30 16:28:40 +08:00
bors
2c8d176e60 Auto merge of #13974 - weihanglo:precise-yank, r=arlosi
feat: stabilize `cargo update --precise <yanked>`

### What does this PR try to resolve?

Stabilize `cargo update --precise <yanked>`.

The cargo team has discussed the stabilization in the meeting today.
The interface of this is quite small and not as controversial as `--precise <pre-release>`,
since there is no version requirement operators involved.
We'd like to move forward and stabilize this part.

Note that `--precise <yanked>` allows using yanked version only for the specified package,
We leave the cascading allowing yanked versions (e.g. <https://github.com/rust-lang/cargo/issues/4225#issuecomment-1930353693>) as a future extension.

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

Check if any adjustment needed for warnings and CLI help text.

### Additional information

cc <https://github.com/rust-lang/cargo/issues/4225>.
2024-05-29 18:43:12 +00:00
bors
cbc12a2ebe Auto merge of #13976 - heiher:master, r=weihanglo
Update openssl-src to 111.28.2+1.1.1w

### What does this PR try to resolve?

This PR is to fix the build of `loongarch64-unknown-linux-musl` target.

Update `openssl-src` from `111.28.1+1.1.1w` to `111.28.2+1.1.1w`.

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

Nothing special.

### Additional information

openssl-src diffs:  cb7b3c8862...8c19f63843
2024-05-29 12:28:59 +00:00
WANG Rui
e57b6ab573 Update openssl-src to 111.28.2+1.1.1w 2024-05-29 11:59:16 +08:00
bors
431db31d0d Auto merge of #13958 - Urgau:check-cfg-config-fingerprint, r=epage
Include `lints.rust.unexpected_cfgs.check-cfg` in the fingerprint

### What does this PR try to resolve?

When changing the `--check-cfg` args in the `lints.rust.unexpected_cfgs.check-cfg` lint config, the build should be restarted as the arguments we pass to the compiler change, and they can change the diagnostics output by generating new or removing some `unexpected_cfgs` warning(s).

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

Look at the before and after test (separate commit).

### Additional information

Similar to https://github.com/rust-lang/cargo/pull/13012 which did that for the declared features.
Contrary to that PR, I didn't add a new `DirtyReason` variant, since even the `[lints]` table didn't get one.

r? `@epage`
2024-05-28 18:17:31 +00:00
Urgau
dfb69e6076 Include lints.rust.unexpected_cfgs.check-cfg into the fingerprint 2024-05-28 20:02:47 +02:00
Weihang Lo
a076f7921b
feat: stabilize cargo update --precise <yanked> 2024-05-28 13:13:56 -04:00
bors
2415192bcd Auto merge of #13973 - epage:elapsed, r=weihanglo
feat(test): Auto-redact elapsed time

By making this a redaction,
it automatically gets applied when generating the snapshot,
removing these extra steps
(that you likely only discover after the fact and have to debug)
2024-05-28 17:06:13 +00:00
bors
11d0002ea0 Auto merge of #13963 - epage:snapbox, r=weihanglo
chore: Update to snapbox 0.6

### What does this PR try to resolve?

This unblocks regex redactions which will help with `Finished in 3.45s` messages as well as maybe switching away from `compare.rs` generally.

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

### Additional information
2024-05-28 03:48:38 +00:00
Ed Page
5ea1c8fea9 feat(test): Auto-redact elapsed time 2024-05-27 21:27:25 -05:00
Ed Page
9af864ee55 refactor: Resolve deprecations 2024-05-27 21:27:03 -05:00
Ed Page
eafc743c0d chore: Update to snapbox 0.6
We needed to tweak the redactions because snapbox no longer normalizes
slashes on redactions unless the data type is a `PathBuf`.
2024-05-27 21:26:20 -05:00
Ed Page
0bd034cd06 refactor(test): Split up calls by type 2024-05-27 21:24:43 -05:00
Ed Page
4a6f25c112 refactor: Resolve snapbox deprecations 2024-05-27 10:28:13 -05:00
bors
95eeafa3ba Auto merge of #13969 - weihanglo:full-commit-sha, r=epage
fix: check if rev is full commit sha for github fast path
2024-05-27 14:19:11 +00:00
Weihang Lo
26c88db051
fix: check if rev is full commit sha for github fast path 2024-05-27 09:56:49 -04:00
bors
37e5f13989 Auto merge of #13964 - surechen:fix_for_lint_copy_drop, r=weihanglo
test: switch from `drop` to `let _` due to nightly rustc change

Fix test error in https://github.com/rust-lang/rust/pull/125533
As lint dropping_copy_types will give suggsetion in this situation.(Changed in https://github.com/rust-lang/rust/pull/125433)
r? `@weihanglo`
2024-05-25 16:10:38 +00:00
surechen
1c8da38a5c Fix test error in https://github.com/rust-lang/rust/pull/125533
As lint dropping_copy_types will give suggsetion in this
situation.(Changed in https://github.com/rust-lang/rust/pull/125433)
2024-05-25 23:49:13 +08:00
Ed Page
602f2f2e21 chore: Upgrade to snapbox 0.5.14 2024-05-24 14:55:47 -05:00
Ed Page
fc733032b3 chore: Bump cargo-credential 2024-05-24 14:55:42 -05:00
Urgau
3ca2120180 Add test for check-cfg config fingerprint not changing 2024-05-24 20:46:24 +02:00
bors
a8d72c675e Auto merge of #13956 - linyihai:missing-fields, r=weihanglo
Improve error description when deserializing partial field struct

### What does this PR try to resolve?

Fixes #13688

### How should we test and review this PR?
one commit add test, one commit fixed and update the test.

### Additional information
2024-05-24 03:34:17 +00:00
Lin Yihai
e05d930e16 fix: Add more context when 'missing feild' 2024-05-24 11:29:46 +08:00
bors
9f7a7157ff Auto merge of #13910 - hi-rustin:rustin-patch-symlink, r=weihanglo
fix: remove symlink dir on Windows
2024-05-23 13:41:32 +00:00
hi-rustin
40ff7be1ad
fix: remove symlink on Windows
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2024-05-23 21:18:33 +08:00
bors
3830c0ccc2 Auto merge of #13957 - iawia002:docs, r=weihanglo
Fix wrong type of rustc-flags in documentation

When I tried to add some custom configuration according to the documentation in https://doc.rust-lang.org/cargo/reference/config.html#configuration-format, I encountered the following error:

```
error: expected a string, but found a array for `rustc-flags` in /xxx/.cargo/config.toml
```

I believe the type of `rustc-flags` should be a string:

95b921ba59/src/doc/src/reference/config.md (L1243-L1253)
2024-05-23 12:45:51 +00:00
Xinzhao Xu
63e84611e5 Fix wrong type of rustc-flags in documentation 2024-05-23 17:01:34 +08:00
Lin Yihai
48742e009c test: Add 'missing field' test 2024-05-23 15:27:52 +08:00
bors
95b921ba59 Auto merge of #13951 - epage:trace, r=ehuss
Add more high level traces

This accounts for more time when running rustc (which turns out to be a significant amount of time).

I'm less sure about the start/wait calls but I'm seeing very different results from different builds of `cargo` and some have some large amounts of unaccounted time that I want to dig into (and callgrind and and samply haven't helped).
2024-05-22 18:25:05 +00:00
Ed Page
8cfccebc31 Add more high level traces
This accounts for more time when running rustc (which turns out to be a
significant amount of time).

I'm less sure about the start/wait calls but I'm seeing very different
results from different builds of `cargo` and some have some large
amounts of unaccounted time that I want to dig into (and callgrind and
and samply haven't helped).
2024-05-22 11:54:57 -05:00
bors
145b225e20 Auto merge of #13948 - Byron:upgrade-gix, r=epage
upgrade gix from 0.62 to 0.63

This is a bugfix release with various improvements, some of which relevant to safety when checking out (possibly freshly cloned) repositories.

See https://github.com/Byron/gitoxide/security/advisories/GHSA-7w47-3wg8-547c and https://github.com/Byron/gitoxide/security/advisories/GHSA-49jc-r788-3fc9 (might not be published yet as it was waiting for feedback at the time of writing).
2024-05-22 15:30:23 +00:00
bors
048e804d0a Auto merge of #13939 - tbu-:pr_template_no_usize, r=weihanglo
Use `i32` rather than `usize` as "default integer" in library template

`usize` was renamed from `uint` in order to convey that it's not the "default integer type". Guide new users to use `i32` instead of `usize`.
2024-05-22 14:30:29 +00:00
Tobias Bucher
a29742a396 Use u64 rather than usize as "default integer" in library template
`usize` was renamed from `uint` in order to convey that it's not the
"default integer type". Guide new users to use integers with specific
bit width instead of `usize`.
2024-05-22 16:11:00 +02:00
Sebastian Thiel
81a59b01ec
upgrade gix from 0.62 to 0.63
This is a bugfix release with various improvements, some of which relevant
to safety when checking out (possibly freshly cloned) repositories.

See https://github.com/Byron/gitoxide/security/advisories/GHSA-7w47-3wg8-547c
and https://github.com/Byron/gitoxide/security/advisories/GHSA-49jc-r788-3fc9
2024-05-22 15:17:45 +02:00
bors
99075f2a47 Auto merge of #13946 - iliana:13555-object-not-found, r=weihanglo
fetch specific commits even if the github fast path fails

### What does this PR try to resolve?

This PR fixes #13555, which describes a regression from 1.64.0 to 1.65.0 where the inability to fetch commit information from api.github.com (the "GitHub fast path") silently changes Cargo's behavior.

Cargo can fetch a specific Git commit from a remote without having to fetch all refs. Prior to #10807, this functionality required a repository hosted on github.com and providing the full commit hash (usually available from the Cargo.lock); after that change, any revision (including abbreviated revisions) that could be resolved by GitHub's API could be fetched directly. However, this logic requires the "GitHub fast path", which was not intended to be robust, to successfully return the resolved commit hash; if a client is currently rate-limited by api.github.com (very common in CI and shared cloud / corporate environments) this fails and Cargo falls back to fetching all refs.

Usually this is not noticeable. However, GitHub allows fetching commits that are related to the repository but not actually part of any of its refs, including commits pushed to a fork. This results in the same command working fine in some environments where api.github.com is accessible, and not working in other environments that are rate-limited, which is very confusing and difficult to debug.

This change adds another branch to cover the regression case: if we are going through the GitHub fast path with a full commit hash, return early indicating that we need to fetch it. (Previously: ~~when the GitHub fast path was unsuccessful, the user is not using the unstable shallow clone options, and we have a full commit hash and expect to be able to fetch it directly because we know it's a github.com repository.~~)

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

I have been testing this PR by temporarily adding a `0.0.0.0 api.github.com` entry to my `/etc/hosts`, which causes the GitHub fast path to always fail, then running:

```
target/release/cargo install --git https://github.com/haha-business/unstable-test-repo.git --rev c9040898c9183ddbb9402dcbf749ed06d6ea90ad
```

This refers to [a particular commit on a fork of the repo](c9040898c9) which won't be found by the fallback path or current Cargo.

**Note** that you will need to delete `~/.cargo/git/checkouts/unstable-test-repo-*` and `~/.cargo/git/db/unstable-test-repo-*` after a successful run with this change in order to reproduce the broken behavior of the current release.

I am having trouble getting the test suite to run at all on my system so I haven't experimented with writing a specific test for this case, but I probably should.

### Additional information

This uses the same logic as the unstable shallow clone support to detect if the revision is a full commit hash. This is not compatible with SHA-256 commit hashes; `git2::Oid` specifically expects a 40-character hexadecimal string. Given that the change introducing this bug was meant to future-proof SHA-256 support (despite only doing so for GitHub repositories), it might be good to make the logic more explicit within Cargo and allow either 40- or 64-character hex strings.

I wanted to keep this change focused on the regression fix, but in testing, pretty much every Git repository I could think of (including non-forges, like git.kernel.org and some repositories I host on my own infrastructure with cgit) supports fetching directly from a commit, so it would be ideal to eventually relax the GitHub requirement for this functionality. However, it would need some sort of fallback logic because I suspect the HTTP [dumb protocol](https://git-scm.com/book/en/v2/Git-Internals-Transfer-Protocols) doesn't support commit references, and I haven't researched when this functionality was added to the smart protocol.
2024-05-22 04:54:54 +00:00