<!--
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?
This PR continues on the build-dir work laid in #14125. (see
[this](https://github.com/rust-lang/cargo/issues/14125#issuecomment-2751658701)
comment)
We add a new `build_directory` field to the `cargo metadata` output when
the `-Z build-dir` feature flag is enabled.
### How should we test and review this PR?
I added a test for metadata output when build-dir is set. There are
already many existing tests that verify that build-dir is not included
if `-Z build-dir` is not passed.
### Additional information
NOTE: I use `build_directory` instead of `build-dir` to match the
existing `target_directory` field in the metadata output
r? @epage
Stop a few tests which aren't marked with `public_network_test` from
trying to access crates.io. While doing so, also make sure that other
`cargo_add` and `cargo_info` tests initialize the registry.
<!-- homu-ignore:start -->
<!--
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.
-->
<!-- homu-ignore:end -->
### What does this PR try to resolve?
It is currently unclear reading the docs how files should be named. [RFC
430](https://rust-lang.github.io/rfcs/0430-finalizing-naming-conventions.html)
is clear on crates and module names, `kebab-case` is never mentioned and
while there are historical considerations, we should guide new
development towards `snake_case`. We should align the documented
defaults to that RFC.
### How should we test and review this PR?
Review the docs and determine if we view value in the change.
### What does this PR try to resolve?
When you have a dependency show up in multiple dependency tables, the
order they are processed was not deterministic. Its hard to predict the
exact effects this was having (e.g. for writing tests for this) but
changing this made #15366 not reproduce anymore for me.
I'm going to consier this as fixing #15366 mostly because how difficult
it is to debug with the non-determinism.
If someone can find a case where this fails, at least it should now
always fail and it should be easier to determine why.
Fixes#15366
### How should we test and review this PR?
### Additional information
When you have a dependency show up in multiple dependency tables,
the order they are processed was not deterministic.
Its hard to predict the exact effects this was having (e.g. for writing
tests for this) but changing this made #15366 not reproduce anymore for me.
I'm going to consier this as fixing #15366 mostly because how difficult
it is to debug with the non-determinism.
If someone can find a case where this fails, at least it should now
always fail and it should be easier to determine why.
Fixes#15366
### What does this PR try to resolve?
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 made in the current implementation:
* 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.
### How should we test and review this PR?
The tests added has covered these cases:
* target src outside package root, e.g., `lib.path = "../lib.rs"`
* `#[doc = include_str!("../outside/pkgroot")]`
* `#[path = "../outside/pkgroot"]`
* `env!`
### Additional information
Fixes#12266Closes#15205
This renames the gc config table to `[cache]` to help avoid some
confusion, and to set up a namespace for possible expansion in the
future for different kind of cache controls.
Low-level settings are stuffed into the `[cache.global-clean]` table,
but we do not expect to stabilize these at this time. Only the top-level
`cache.auto-clean-frequency` setting is expected to be stabilized.
Closes https://github.com/rust-lang/cargo/issues/14292
This renames the gc config table to `[cache]` to help avoid some
confusion, and to set up a namespace for possible expansion in the
future for different kind of cache controls.
Low-level settings are stuffed into the `[cache.global-clean]` table,
but we do not expect to stabilize these at this time. Only the top-level
`cache.auto-clean-frequency` setting is expected to be stabilized.
Closes https://github.com/rust-lang/cargo/issues/14292
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.
### 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.
### 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