19983 Commits

Author SHA1 Message Date
Weihang Lo
a18e60462e
feat(fingerprint): integrate rustdoc dep-info files
This leverages the unstable `--emit=depinfo` option from rustdoc,
so that rustdoc invocation rebuild can be better tracked
without traversing the entire directory.

Some design decisions:

* Rustdoc's depinfo doesn't and shouldn't emit to `target/doc`,
  as the directory is considered part of the final artifact directory.
  In regard to that, we specify the dep-info output path to
  the fingerprint directory of rustdoc invocation.
  It looks like this
  `target/debug/.fingerprint/serde-12d29d32b3b8b38f/doc-lib-serde.d`.
* We also start supporting `-Zchecksum-freshness` as a side effect.
  Could make it a separate PR if desired.
* `-Zbinary-dep-depinfo` is not enabled along with this,
  since doc generations don't really require any binary dependencies.
2025-03-28 22:07:30 -07:00
Gábor Szabó
840d63b574
rename the author field to be authors in book.toml 2025-03-28 17:26:28 +03:00
Weihang Lo
1f6d4be081
test(doc): show scenarios cargo doc not rebuild 2025-03-27 22:45:49 -07:00
Weihang Lo
80525dc48a
Revert "Temporarily ignore cargo_test_doctest_xcompile_ignores" (#15357)
This reverts https://github.com/rust-lang/cargo/pull/15348 now that
https://github.com/rust-lang/rust/pull/138877 is on nightly.
2025-03-28 02:00:17 +00:00
Eric Huss
bbce504bf3
Revert "Temporarily ignore cargo_test_doctest_xcompile_ignores" 2025-03-27 18:28:09 -07:00
Weihang Lo
3530a26e5a
docs(unstable): explain -Z rustdoc-depinfo 2025-03-27 12:22:27 -04:00
Weihang Lo
95dafab660
feat(unstable): add -Zrustdoc-depinfo flag 2025-03-27 11:55:55 -04:00
Weihang Lo
84a38b9376
Don't canonicalize executable path in cargo_exe (#15355)
### What does this PR try to resolve?

Follow up to #9991. The issue explains why but in short canonicalising
executable paths causes issues for symlinks. It seems this was missed in
#9991.

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

Note that the comment I deleted is wrong since #9991.

Running existing test should ensure this doesn't break anything.
2025-03-27 00:40:31 +00:00
Chris Denton
d82b596962
Don't canonicalize in cargo_exe 2025-03-26 23:47:08 +00:00
Ed Page
a6c604d1b8
fix(package): update tracking issue for --message-format (#15354)
Went ahead and created a new tracking issue
<https://github.com/rust-lang/cargo/issues/15353>.
2025-03-26 18:11:00 +00:00
Weihang Lo
a24066a79c
fix(package): update tracking issue for --message-format 2025-03-26 13:37:01 -04:00
Weihang Lo
280efd3dce
docs(contrib): Expand the description of team meetings (#15349)
### What does this PR try to resolve?

The goal is to make Cargo team meetings more inviting. This PR includes
both the information for more people to attend while framing the purpose
of the meeting to set appropriate expectations.

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

### Additional information
2025-03-26 16:53:06 +00:00
Ed Page
856f1bae5d
feat(package): add unstable --message-format flag (#15311)
### What does this PR try to resolve?

#11666

This adds an unstable `--message-format` flag to `cargo package` to help
`--list` output in newline-delimited JSON format.

See
<https://github.com/weihanglo/cargo/blob/package-list-fmt/src/doc/man/cargo-package.md#package-options>
for more on what is provided.

Open questions
- `--list json` or `--message-format json`, see
https://github.com/rust-lang/cargo/pull/15311#discussion_r1995637878
- a single json blob vs N? What is N? See
https://github.com/rust-lang/cargo/pull/15311#discussion_r1995641250
- Is the current format `plain` or `human`, see
https://github.com/rust-lang/cargo/pull/15311#discussion_r2012443601
- snake_case or kebab-case, see
https://github.com/rust-lang/cargo/pull/15311#discussion_r1995641593

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

* This currently outputs absolute paths.
  If we don't want to show absolute paths in the JSON output,
  could switch to relative path to either package root or cwd
  (I prefer the latter though).
* The actual schema, format option names, and field names is open to
discuss and change. See also
<https://github.com/rust-lang/cargo/issues/12377> for reference.
2025-03-26 16:32:05 +00:00
Ed Page
521bd7650c
feat(complete): Added completion for --profile (#15308)
### What does this PR try to resolve?

This attempts to complete the autocompleter for `cargo build --profile
<TAB>`, it loads the built in profiles and the custom profile present in
`Cargo.toml` and `.cargo/config.toml` if present when pressing TAB key,
in the completion value it also adds an description inspired by
[this](https://github.com/rust-lang/cargo/blob/master/src/cargo/core/compiler/job_queue/mod.rs#L805-L813)

![Screenshot from 2025-03-14
02-17-40](https://github.com/user-attachments/assets/6fc784a0-e3e7-4deb-9252-847d720894c1)

Related to #14520
2025-03-26 13:48:54 +00:00
utnim2
feb0e50b68 feat(complete): Added completion for --profile
- Added completion for `--profile` in `cargo build`
 - Loads the built in profile and custom profiles present in `Cargo.toml` and `.cargo/config.toml`
2025-03-26 12:31:44 +05:30
Weihang Lo
6344cad39a
Uplift windows Cygwin DLL import libraries (#15193)
- needed to link std correctly

Related: https://github.com/rust-lang/rust/pull/134999
2025-03-26 04:13:53 +00:00
Ookiineko
28d8d7702d add import library (.dll.a) file type for Cygwin
- needed to link std correctly

Signed-off-by: Ookiineko <chiisaineko@protonmail.com>
2025-03-26 11:05:18 +08:00
Weihang Lo
e354769b1f
feat(package): JSON message format for --list 2025-03-25 23:02:37 -04:00
Weihang Lo
d493e38e15
refactor(package): attach path info to GeneratedFile
This is needed for `cargo package --list` JSON message
to access the orignal file path information
for the generated file kind
2025-03-25 23:02:37 -04:00
Weihang Lo
4e8014f4be
feat(schemas): add PackageList message schema
This is is for `cargo package --list` in JSON format
2025-03-25 23:02:37 -04:00
Weihang Lo
02226aee64
docs(unstable): --message-format flag in cargo-package 2025-03-25 23:02:37 -04:00
Weihang Lo
9f9ff628ef
docs(package): man page for cargo package --message-format 2025-03-25 23:02:37 -04:00
Weihang Lo
781c7ed515
feat(package): add unstable --message-format flag
The behavior is not implemented yet
2025-03-25 23:02:37 -04:00
Eric Huss
6a70640c91
do not pass cdylib link args to test (#15317)
<!--
Thanks for submitting a pull request 🎉! Here are some tips for you:

* If this is your first contribution, read "Cargo Contribution Guide"
first:
  https://doc.crates.io/contrib/
* Run `cargo fmt --all` to format your code changes.
* Small commits and pull requests are always preferable and easy to
review.
* If your idea is large and needs feedback from the community, read how:
  https://doc.crates.io/contrib/process/#working-on-large-features
* Cargo takes care of compatibility. Read our design principles:
  https://doc.crates.io/contrib/design.html
* When changing help text of cargo commands, follow the steps to
generate docs:

https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages
* If your PR is not finished, set it as "draft" PR or add "WIP" in its
title.
* It's ok to use the CI resources to test your PR, but please don't
abuse them.

### What does this PR try to resolve?

Explain the motivation behind this change.
A clear overview along with an in-depth explanation are helpful.

You can use `Fixes #<issue number>` to associate this PR to an existing
issue.

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

Demonstrate how you test this change and guide reviewers through your
PR.
With a smooth review process, a pull request usually gets reviewed
quicker.

If you don't know how to write and run your tests, please read the
guide:
https://doc.crates.io/contrib/tests

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.
-->

fixes #12663
2025-03-25 18:57:24 +00:00
Ed Page
68907356e1
fix: revert the behavior checking lockfile's VCS status (#15341)
### What does this PR try to resolve?

Fixes #15339

Lockfile might be gitignore'd,
So it never shows up in `git status`.

However, `cargo packag` vcs checks actually performs `git status
--untracked --ignored`.
It is a bit confusing that lockfile is ignored but still counts as dirty
from the report of `cargo package`.

There are some more nuances:
We check lockfile's VCS status if the lockfile is ouside the current
package root. That means a non-workspace Cargo package will not have
this VCS check. I don't think it is good that we have diverged behaviors
Hence this revert.

We can always re-evaluate later,
as we've reserved rooms for doing more dirty checks.

https://github.com/rust-lang/cargo/issues/14967#issuecomment-2651329783

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

See if the revert is what we want now.
Or we should do a more thorough check for both workspace and
non-workspace cases.

### Additional information

This is a revert of f0907fca16a84101d69fc53272a955e8bb53d9fe from #15276
2025-03-25 17:56:35 +00:00
Weihang Lo
259128d270
fix: revert the behavior checking lockfile's VCS
Lockfile might be gitignore'd,
So it never shows up in `git status`.

However, `cargo packag` vcs checks actually performs
`git status --untracked --ignored`.
It is a bit confusing that lockfile is ignored but still counts as dirty
from the report of `cargo package`.

There are some more nuances:
We check lockfile's VCS status if the lockfile is ouside the current
package root. That means a non-workspace Cargo package will not have
this VCS check. I don't think it is good that we have diverged behaviors
Hence this revert.

We can always re-evaluate later,
as we've reserved rooms for doing more dirty checks.

https://github.com/rust-lang/cargo/issues/14967#issuecomment-2651329783
2025-03-25 13:15:34 -04:00
Weihang Lo
e3b5faaaef
Temporarily ignore cargo_test_doctest_xcompile_ignores (#15348)
This was broken due to a change in
https://github.com/rust-lang/rust/pull/138535. There is an approved PR
in https://github.com/rust-lang/rust/pull/138877 to fix it, but it may
take a day or two for it to make its way to nightly. This should be
reverted after it hits nightly.
2025-03-25 15:46:36 +00:00
Eric Huss
98a273f770 Temporarily ignore cargo_test_doctest_xcompile_ignores
This was broken due to a change in
https://github.com/rust-lang/rust/pull/138535. There is an approved PR
in https://github.com/rust-lang/rust/pull/138877 to fix it, but it may
take a day or two for it to make its way to nightly. This should be
reverted after it hits nightly.
2025-03-25 08:02:22 -07:00
Ed Page
e351a7f84d docs(contrib): Expand the description of team meetings
This both includes the information for more people to attend while
framing the purpose of the meeting to set appropriate expectations.
2025-03-25 10:00:57 -05:00
Ed Page
cc585c0175
docs: fix typo in the "Shared cache" section (#15346)
### What does this PR try to resolve?
This PR addresses a typo in the "Shared cache" section. The word
"environmental" has been corrected to "environment" for proper grammar
in the phrase:
- "set `RUSTC_WRAPPER` environmental variable to `sccache`" → "set
`RUSTC_WRAPPER` environment variable to `sccache`".

### How should we test and review this PR?
Review the change in the relevant documentation section and verify that
the typo has been corrected. No functional changes are involved.

### Additional information
This is a simple grammar fix to ensure clarity in the documentation.
2025-03-22 11:18:54 +00:00
Darya
96523cb1b2
docs: fix typo in the "Shared cache" section 2025-03-22 13:08:47 +03:00
Weihang Lo
7d11b58efc
Fix some issues with future-incompat report generation (#15345)
This fixes various issues with the future-incompat report. In
particular, it addresses the off-by-one for the `--id` flag when the
report is already cached, and it doesn't recommend updating dependencies
when the error comes from a local crate. See each commit for more
details.

Fixes #15337
2025-03-22 00:24:49 +00:00
Eric Huss
0b2299e889 Remove an excess newline
The udpate_message already has a newline when it is there. When it is an
empty string, it ends up adding an unnecessary blank line.
2025-03-21 16:32:28 -07:00
Eric Huss
b17b9a4b90 Elaborate the full output when there are newer versions available
This output was never tested.
2025-03-21 16:32:28 -07:00
Eric Huss
4d961ed19c Don't show a suggestion to update dependencies
This removes the suggestion to update dependencies when the future
incompat error comes from the local crate. It doesn't make sense to
suggest that.
2025-03-21 16:32:28 -07:00
Eric Huss
497cfe5e48 Remove excess trailing space 2025-03-21 16:32:28 -07:00
Eric Huss
3fb97ecf28 Fix off-by-one error when future-incompat report is cached
This fixes a problem introduced by
https://github.com/rust-lang/cargo/pull/11648 where the future-incompat
report will tell you to run with an `--id` flag with the wrong value
if the report is already cached.

The solution is to add a method to determine which ID to use for the
suggestions *before* attempting to save the report.
2025-03-21 16:32:26 -07:00
Eric Huss
afdfd9263e Add some more explicit future-incompat tests
This updates some tests to include the full output for both a local
crate and a dependency.
2025-03-21 16:26:45 -07:00
Eric Huss
941c414a90 Add test for cached report id 2025-03-21 16:04:43 -07:00
Ed Page
307cbfda31
feat: Add custom completer for cargo <TAB> to complete aliases defined in config.toml (#15319)
<!--
Thanks for submitting a pull request 🎉! Here are some tips for you:

* If this is your first contribution, read "Cargo Contribution Guide"
first:
  https://doc.crates.io/contrib/
* Run `cargo fmt --all` to format your code changes.
* Small commits and pull requests are always preferable and easy to
review.
* If your idea is large and needs feedback from the community, read how:
  https://doc.crates.io/contrib/process/#working-on-large-features
* Cargo takes care of compatibility. Read our design principles:
  https://doc.crates.io/contrib/design.html
* When changing help text of cargo commands, follow the steps to
generate docs:

https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages
* If your PR is not finished, set it as "draft" PR or add "WIP" in its
title.
* It's ok to use the CI resources to test your PR, but please don't
abuse them.

### What does this PR try to resolve?

Explain the motivation behind this change.
A clear overview along with an in-depth explanation are helpful.

You can use `Fixes #<issue number>` to associate this PR to an existing
issue.

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

Demonstrate how you test this change and guide reviewers through your
PR.
With a smooth review process, a pull request usually gets reviewed
quicker.

If you don't know how to write and run your tests, please read the
guide:
https://doc.crates.io/contrib/tests

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.
-->

### What does this PR try to resolve?

Related to https://github.com/rust-lang/cargo/issues/14520

This PR introduces auto-completion for the `cargo <TAB>` option. When a
user types `cargo <TAB>` and presses the TAB key, the system will
automatically suggest aliases defined in `config.toml`

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

To verify this feature, follow these steps:
1. In the terminal, type `cargo <TAB>`
2. Press the TAB key.
3. You should see aliases suggestions

https://github.com/user-attachments/assets/d8a265e8-bbd9-4f58-8121-80caf142d8a6
2025-03-20 20:00:39 +00:00
Ed Page
7440762a78
fix(build-dir): Renamed workspace-manifest-path-hash to workspace-path-hash (#15334)
<!--
Thanks for submitting a pull request 🎉! Here are some tips for you:

* If this is your first contribution, read "Cargo Contribution Guide"
first:
  https://doc.crates.io/contrib/
* Run `cargo fmt --all` to format your code changes.
* Small commits and pull requests are always preferable and easy to
review.
* If your idea is large and needs feedback from the community, read how:
  https://doc.crates.io/contrib/process/#working-on-large-features
* Cargo takes care of compatibility. Read our design principles:
  https://doc.crates.io/contrib/design.html
* When changing help text of cargo commands, follow the steps to
generate docs:

https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages
* If your PR is not finished, set it as "draft" PR or add "WIP" in its
title.
* It's ok to use the CI resources to test your PR, but please don't
abuse them.

### What does this PR try to resolve?

Explain the motivation behind this change.
A clear overview along with an in-depth explanation are helpful.

You can use `Fixes #<issue number>` to associate this PR to an existing
issue.

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

Demonstrate how you test this change and guide reviewers through your
PR.
With a smooth review process, a pull request usually gets reviewed
quicker.

If you don't know how to write and run your tests, please read the
guide:
https://doc.crates.io/contrib/tests

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.
-->

### What does this PR try to resolve?

Small PR to rename `workspace-manifest-path-hash` to
`workspace-path-hash` in the build-dir template as mentioned
[here](https://github.com/rust-lang/cargo/issues/14125#issuecomment-2733611870)
(cc: #14125)

r? @epage
2025-03-20 19:51:15 +00:00
Weihang Lo
8364f7b687
feat: vcs, color, and message format native completion (#15322)
### What does this PR try to resolve?

Related to https://github.com/rust-lang/cargo/issues/14520

This PR introduces auto-completion for following options:
1. `--color` option with values: auto, always, never
2. `--vcs` option with values: git, hg, pijul, fossil, none
3. `--message-format` option with values: human, short, json,
json-diagnostic-short, json-diagnostic-rendered

Take `--color` as an example, when a user types ` cargo build --color
<TAB>`the system will automatically suggest auto, always, never

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

To verify this feature, follow these steps:
1. In the terminal, type `cargo build --color <TAB>` or `cargo new
my_project --vcs <TAB>` or `cargo check --message-format <TAB>`
2. Press the TAB key.
3. You should see option suggestions

https://github.com/user-attachments/assets/0cf12785-fdc0-4fb1-84b5-715c29a95e0e
2025-03-20 15:07:41 +00:00
NOOMA-42
3ea0e6b751
feat: vcs, color, and message format native completion 2025-03-20 22:16:27 +08:00
NOOMA-42
7e98310bbd
feat: Add custom completer for cargo <TAB> to complete aliases defined in config.toml 2025-03-20 15:04:00 +08:00
Ross Sullivan
5b077cb489
chore(build-dir): Renamed workspace-manifest-path-hash to workspace-path-hash 2025-03-20 12:16:40 +09:00
Weihang Lo
c746f164fe
Fix [env] relative description in reference (#15332)
<!--
Thanks for submitting a pull request 🎉! Here are some tips for you:

* If this is your first contribution, read "Cargo Contribution Guide"
first:
  https://doc.crates.io/contrib/
* Run `cargo fmt --all` to format your code changes.
* Small commits and pull requests are always preferable and easy to
review.
* If your idea is large and needs feedback from the community, read how:
  https://doc.crates.io/contrib/process/#working-on-large-features
* Cargo takes care of compatibility. Read our design principles:
  https://doc.crates.io/contrib/design.html
* When changing help text of cargo commands, follow the steps to
generate docs:

https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages
* If your PR is not finished, set it as "draft" PR or add "WIP" in its
title.
* It's ok to use the CI resources to test your PR, but please don't
abuse them.

### What does this PR try to resolve?

Explain the motivation behind this change.
A clear overview along with an in-depth explanation are helpful.

You can use `Fixes #<issue number>` to associate this PR to an existing
issue.

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

Demonstrate how you test this change and guide reviewers through your
PR.
With a smooth review process, a pull request usually gets reviewed
quicker.

If you don't know how to write and run your tests, please read the
guide:
https://doc.crates.io/contrib/tests

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.
-->

Current short description does not match reality nor the longer
description:
> Setting the relative flag evaluates the value as a config-relative
path that is relative to the parent directory of the .cargo directory
that contains the config.toml file. The value of the environment
variable will be the full absolute path.
2025-03-20 00:00:55 +00:00
Mingwei Samuel
f72e3a271b
Update config.md 2025-03-19 14:57:45 -07:00
Mingwei Samuel
826234c151
Fix [env] relative description in reference 2025-03-19 14:52:23 -07:00
Ed Page
aca563aad3
chore: fix some typos (#15329)
<!--
Thanks for submitting a pull request 🎉! Here are some tips for you:

* If this is your first contribution, read "Cargo Contribution Guide"
first:
  https://doc.crates.io/contrib/
* Run `cargo fmt --all` to format your code changes.
* Small commits and pull requests are always preferable and easy to
review.
* If your idea is large and needs feedback from the community, read how:
  https://doc.crates.io/contrib/process/#working-on-large-features
* Cargo takes care of compatibility. Read our design principles:
  https://doc.crates.io/contrib/design.html
* When changing help text of cargo commands, follow the steps to
generate docs:

https://github.com/rust-lang/cargo/tree/master/src/doc#building-the-man-pages
* If your PR is not finished, set it as "draft" PR or add "WIP" in its
title.
* It's ok to use the CI resources to test your PR, but please don't
abuse them.

### What does this PR try to resolve?

Explain the motivation behind this change.
A clear overview along with an in-depth explanation are helpful.

You can use `Fixes #<issue number>` to associate this PR to an existing
issue.

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

Demonstrate how you test this change and guide reviewers through your
PR.
With a smooth review process, a pull request usually gets reviewed
quicker.

If you don't know how to write and run your tests, please read the
guide:
https://doc.crates.io/contrib/tests

### Additional information

Other information you want to mention in this PR, such as prior arts,
future extensions, an unresolved problem, or a TODO list.
-->

 fix some typos
2025-03-19 13:55:32 +00:00
pudongair
6c7c360dec chore: fix some typos
Signed-off-by: pudongair <744355276@qq.com>
2025-03-19 21:05:18 +08:00