Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci test #76

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open

Ci test #76

wants to merge 51 commits into from

Conversation

weihanglo
Copy link
Owner

No description provided.

Eh2406 and others added 30 commits December 24, 2024 19:04
`check_repo_state` checks the entire git repo status.
This is usually fine if you have only a few packages in a workspace.

For huge monorepos, it may hit performance issues.

For example,
on awslabs/aws-sdk-rust@2cbd34d
the workspace has roughly 434 members to publish.
`git ls-files` reported us 204379 files in this Git repository.
That means git may need to check status of all files 434 times.
That would be `204379 * 434 = 88,700,486` checks!

Moreover, the current algorithm is finding the intersection of
`PathSource::list_files` and `git status`.
It is an `O(n^2)` check.
Let's assume files are evenly distributed into each package,
so roughly 470 files per package.
If we're unlucky to have some dirty files, say 100 files.
We will have to do `470 * 100 = 47,000` times of path comparisons.

Even worse, because we `git status` everything in the repo,
we'll have to it for all members,
even when those dirty files are not part of the current package in question.
So it becomes `470 * 100 * 434 = 20,398,000`!

Instead of comparing with the status of the entire repository,
this patch use the magic pathspec[1] to tell git only reports
paths that match a certain path prefix.

This wouldn't help the `O(n^2)` algorithm,
but at least it won't check dirty files outside the current package.
Also, we don't `git status` against entire git worktree/index anymore.

[1]: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec
This renames variables named `str` to other names, to make sure `str`
always refers to a type.
This renames variables named `str` to other names, to make sure `str`
always refers to a type.
It turns out, running `cargo rustc --print cfg -Zunstable-options` (and
the like, rust-lang#9357) fail with
`.cargo/config.toml` setups like
```toml
[build]
# custom target json that lives in `./targets/my-super-cool-target.json`
target = "my-super-cool-target"

[env]
RUST_TARGET_PATH = { value = "./targets", relative = true }
```
resulting in
```

❯ cargo rustc --print cfg -Zunstable-options
error: Error loading target specification: Could not find specification for target "my-super-cool-target". Run `rustc --print target-list` for a list of built-in targets

error: process didn't exit successfully: `C:\Users\lukas\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\rustc.exe --target my-super-cool-target --print cfg` (exit code: 1)
```

The reason for that is that cargo recognizes the target from the
`.cargo/config` and then implicitly passes that along to the spawned
rustc process, but it does so without passing along the important
environment that is required for the target tuple to make sense.

(can add a test if desired, just tell me where)
### What does this PR try to resolve?

This is a followup to rust-lang#14800. Like that PR, this is a small incremental
change that does not pull its own weight. If this PR is accepted, the
next PR will unlock large performance wins. I am not posting them
together because the logic of why this PR is correct is subtle and
deserves to be discussed and reviewed without unrelated code changes.

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

All tests pass on all commits. This **should** be reviewed one commit at
a time.

### Additional information

I pushed one commit at a time, so that CI can confirm that the assert
(in the first commit) is never hit.
This was done by upgrading schemars.  Hard to tell what else was changed
because of the noise from the other changes in the layout.

Fixes rust-lang#15030
We're making the `missing_abi` lint a warning in rustc, see:
rust-lang/rust#132397
As discussed in today's cargo meeting, and in
https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/while.20we're.20breaking.20stable.20hash,
we are keeping the manual impl but shortening the comment about why it
is needed.
Instead of allowing any type in metadata, we were specifying fields like
`"string": "<any string>"`.

Found this when looking into rust-lang#15030

<!--
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?

The version update addresses the `flatten` issue but I also fixed an
issue with `lints.workspace`.

I didn't notice any other user-facing side effect of the upgrade but I
could have missed that in the noise.

Fixes rust-lang#15030

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

### Additional information
This will be resolved in the next commit
This is a horrible hack,
It lets the rustc invocation for learning target info always
emit warnings as warnings.
But at least it unblocks people who pass `-Awarnings` via RUSTFLAGS.

A long-term solution is a better interface
between build systems and the compiler.
See the discussion on Zulip:
https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Improving.20communication.20interface.20between.20cargo.2Frustc

Fixes rust-lang#8010
…ang#15036)

### What does this PR try to resolve?

This is a horrible hack,
which lets the rustc invocation for learning target info always emit
warnings as warnings.
But at least it unblocks people who pass `-Awarnings` via RUSTFLAGS.

A long-term solution is a better interface
between build systems and the compiler.
See the discussion on Zulip:

https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/Improving.20communication.20interface.20between.20cargo.2Frustc

Fixes rust-lang#8010

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

Ensure `CFG_DISABLE_CROSS_TESTS` is not set,
and run `cargo t --test testsuite
always_emit_warnings_as_warnings_when_learning_target_info`

This also additionally adds `wasm32-unknown-unknown` target to Cargo's
CI.

### Additional information
This was inspired by a recent Cargo team discussion on whether we should
generally elide default values.
This will also help with https://rust-lang.github.io/rust-project-goals/2025h1/cargo-plumbing.html

Case studies in schema design:
- rust-lang#14506
- rust-lang#10543
renovate bot and others added 21 commits January 9, 2025 19:15
### What does this PR try to resolve?

This was inspired by a recent Cargo team discussion on whether we should
generally elide default values.
This will also help with
https://rust-lang.github.io/rust-project-goals/2025h1/cargo-plumbing.html

Case studies in schema design:
- rust-lang#14506
- rust-lang#10543

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

### Additional information
"identity" `.into()` calls where the base's type isn't changed is a
future compatibility foot-gun (like the issue we had with `time` a few
months ago) as new `impl Into` blocks can cause previously compiling
code to start failing. I don't foresee these ones in particular causing
problems anytime soon, but I noticed them and might as well clean them
up as a drive-by.
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [MSRV:1](https://github.com/rust-lang/rust) | minor | `1.83`
-> `1.84` |

---

### Release Notes

<details>
<summary>rust-lang/rust (MSRV:1)</summary>

###
[`v1.84`](https://github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1840-2025-01-09)

[Compare
Source](https://github.com/rust-lang/rust/compare/1.83.0...1.84.0)

\==========================

<a id="
Language"></a>

## Language

- [Allow `#[deny]` inside `#[forbid]` as a
no-op](https://github.com/rust-lang/rust/pull/121560/)
- [Show a warning when `-Ctarget-feature` is used to toggle features
that can lead to unsoundness due to ABI
mismatches](https://github.com/rust-lang/rust/pull/129884)
- [Use the next-generation trait solver in
coherence](https://github.com/rust-lang/rust/pull/130654)
- [Allow coercions to drop the principal of trait
objects](https://github.com/rust-lang/rust/pull/131857)
- [Support `/` as the path separator for `include!()` in all cases on
Windows](https://github.com/rust-lang/rust/pull/125205)
- [Taking a raw ref (`raw (const|mut)`) of a deref of a pointer (`*ptr`)
is now safe](https://github.com/rust-lang/rust/pull/129248)
- [Stabilize s390x inline
assembly](https://github.com/rust-lang/rust/pull/131258)
- [Stabilize Arm64EC inline
assembly](https://github.com/rust-lang/rust/pull/131781)
- [Lint against creating pointers to immediately dropped
temporaries](https://github.com/rust-lang/rust/pull/128985)
- [Execute drop glue when unwinding in an `extern "C"`
function](https://github.com/rust-lang/rust/pull/129582)

<a id="1.84.0-Compiler"></a>

## Compiler

- [Add `--print host-tuple` flag to print the host target tuple and
affirm the "target tuple" terminology over "target
triple"](https://github.com/rust-lang/rust/pull/125579)
- [Declaring functions with a calling convention not supported on the
current target now triggers a hard
error](https://github.com/rust-lang/rust/pull/129935)
- [Set up indirect access to external data for
`loongarch64-unknown-linux-{musl,ohos}`](https://github.com/rust-lang/rust/pull/131583)
- [Enable XRay instrumentation for LoongArch Linux
targets](https://github.com/rust-lang/rust/pull/131818)
- [Extend the `unexpected_cfgs` lint to also warn in external
macros](https://github.com/rust-lang/rust/pull/132577)
- [Stabilize WebAssembly `multivalue`, `reference-types`, and
`tail-call` target
features](https://github.com/rust-lang/rust/pull/131080)
- [Added Tier 2 support for the `wasm32v1-none`
target](https://github.com/rust-lang/rust/pull/131487)

<a id="1.84.0-Libraries"></a>

## Libraries

- [Implement `From<&mut {slice}>` for
`Box/Rc/Arc<{slice}>`](https://github.com/rust-lang/rust/pull/129329)
- [Move `<float>::copysign`, `<float>::abs`, `<float>::signum` to
`core`](https://github.com/rust-lang/rust/pull/131304)
- [Add `LowerExp` and `UpperExp` implementations to
`NonZero`](https://github.com/rust-lang/rust/pull/131377)
- [Implement `FromStr` for `CString` and `TryFrom<CString>` for
`String`](https://github.com/rust-lang/rust/pull/130608)
- [`std::os::darwin` has been made
public](https://github.com/rust-lang/rust/pull/123723)

<a id="1.84.0-Stabilized-APIs"></a>

## Stabilized APIs

-
[`Ipv6Addr::is_unique_local`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.is_unique_local)
-
[`Ipv6Addr::is_unicast_link_local`](https://doc.rust-lang.org/stable/core/net/struct.Ipv6Addr.html#method.is_unicast_link_local)
-
[`core::ptr::with_exposed_provenance`](https://doc.rust-lang.org/stable/core/ptr/fn.with_exposed_provenance.html)
-
[`core::ptr::with_exposed_provenance_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.with_exposed_provenance_mut.html)
-
[`<ptr>::addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.addr)
-
[`<ptr>::expose_provenance`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.expose_provenance)
-
[`<ptr>::with_addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.with_addr)
-
[`<ptr>::map_addr`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.map_addr)
-
[`<int>::isqrt`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.isqrt)
-
[`<int>::checked_isqrt`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.checked_isqrt)
-
[`<uint>::isqrt`](https://doc.rust-lang.org/stable/core/primitive.u32.html#method.isqrt)
-
[`NonZero::isqrt`](https://doc.rust-lang.org/stable/core/num/struct.NonZero.html#impl-NonZero%3Cu128%3E/method.isqrt)
-
[`core::ptr::without_provenance`](https://doc.rust-lang.org/stable/core/ptr/fn.without_provenance.html)
-
[`core::ptr::without_provenance_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.without_provenance_mut.html)
-
[`core::ptr::dangling`](https://doc.rust-lang.org/stable/core/ptr/fn.dangling.html)
-
[`core::ptr::dangling_mut`](https://doc.rust-lang.org/stable/core/ptr/fn.dangling_mut.html)

These APIs are now stable in const contexts

-
[`AtomicBool::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicBool.html#method.from_ptr)
-
[`AtomicPtr::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicPtr.html#method.from_ptr)
-
[`AtomicU8::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU8.html#method.from_ptr)
-
[`AtomicU16::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU16.html#method.from_ptr)
-
[`AtomicU32::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU32.html#method.from_ptr)
-
[`AtomicU64::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicU64.html#method.from_ptr)
-
[`AtomicUsize::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.from_ptr)
-
[`AtomicI8::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI8.html#method.from_ptr)
-
[`AtomicI16::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI16.html#method.from_ptr)
-
[`AtomicI32::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI32.html#method.from_ptr)
-
[`AtomicI64::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicI64.html#method.from_ptr)
-
[`AtomicIsize::from_ptr`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicIsize.html#method.from_ptr)
-
[`<ptr>::is_null`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_null-1)
-
[`<ptr>::as_ref`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.as_ref-1)
-
[`<ptr>::as_mut`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.as_mut)
-
[`Pin::new`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.new)
-
[`Pin::new_unchecked`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.new_unchecked)
-
[`Pin::get_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_ref)
-
[`Pin::into_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.into_ref)
-
[`Pin::get_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_mut)
-
[`Pin::get_unchecked_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.get_unchecked_mut)
-
[`Pin::static_ref`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.static_ref)
-
[`Pin::static_mut`](https://doc.rust-lang.org/stable/core/pin/struct.Pin.html#method.static_mut)

<a id="1.84.0-Cargo"></a>

## Cargo

- [Stabilize MSRV-aware resolver
config](https://github.com/rust-lang/cargo/pull/14639/)
- [Stabilize resolver
v3](https://github.com/rust-lang/cargo/pull/14754/)

<a id="1.84-Rustdoc"></a>

## Rustdoc

- [rustdoc-search: improve type-driven
search](https://github.com/rust-lang/rust/pull/127589)

<a id="1.84.0-Compatibility-Notes"></a>

## Compatibility Notes

- [Enable by default the `LSX` target feature for LoongArch Linux
targets](https://github.com/rust-lang/rust/pull/132140)
- [The unstable `-Zprofile` flag (“gcov-style” coverage instrumentation)
has been
removed.](https://github.com/rust-lang/rust/pull/131829) This
does not affect the stable flags for coverage instrumentation
(`-Cinstrument-coverage`) and profile-guided optimization
(`-Cprofile-generate`, `-Cprofile-use`), which are unrelated and remain
available.
- Support for the target named `wasm32-wasi` has been removed as the
target is now named `wasm32-wasip1`. This completes the
[transition](https://github.com/rust-lang/compiler-team/issues/607)
[plan](https://github.com/rust-lang/compiler-team/issues/695)
for this target following [the introduction of
`wasm32-wasip1`](https://github.com/rust-lang/rust/pull/120468)
in Rust 1.78. Compiler warnings on [use of
`wasm32-wasi`](https://github.com/rust-lang/rust/pull/126662)
introduced in Rust 1.81 are now gone as well as the target is removed.
- [The syntax `&pin (mut|const) T` is now parsed as a type which in
theory could affect macro expansion results in some edge
cases](https://github.com/rust-lang/rust/pull/130635#issuecomment-2375462821)
- [Legacy syntax for calling `std::arch` functions is no longer
permitted to declare items or bodies (such as closures, inline consts,
or async
blocks).](https://github.com/rust-lang/rust/pull/130443#issuecomment-2445678945)
- The `wasm32-unknown-emscripten` target's binary release of the
standard library is now [built with the latest emsdk
3.1.68](https://github.com/rust-lang/rust/pull/131533), which
fixes an ABI-incompatibility with Emscripten >= 3.1.42. If you are
locally using a version of emsdk with an incompatible ABI (e.g. before
3.1.42 or a future one), you should build your code with `-Zbuild-std`
to ensure that `std` uses the correct ABI.
- [Declaring functions with a calling convention not supported on the
current target now triggers a hard
error](https://github.com/rust-lang/rust/pull/129935)
- [The next-generation trait solver is now enabled for coherence, fixing
multiple soundness
issues](https://github.com/rust-lang/rust/pull/130654)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* * * * *" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/rust-lang/cargo).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS45Mi4wIiwidXBkYXRlZEluVmVyIjoiMzkuOTIuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->
### What does this PR try to resolve?

Reported at
https://www.reddit.com/r/rust/comments/1hxfo8n/announcing_rust_1840/m6ajr41/

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

### Additional information
<!--
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?

Fixes rust-lang#13712

Adds a warning if there is an error updating the index cache.
It also attempts to avoid warning spam as requested in [this
comment](rust-lang#13712 (comment))

Below is an example output

```
    Updating crates.io index
warning: failed to write cache, path: /home/ross/.cargo/registry/index/index.crates.io-1949cf8c6b5b557f/.cache/ba/se/base64, error: Permission denied (os error 13)
   Compiling serde v1.0.217
   Compiling r-efi v5.2.0
   Compiling base64 v0.22.1
   Compiling cargo-13712 v0.1.0 (/home/ross/projects/cargo-13712)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.20s

```

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

I tested this on my machine by manually changing the owner/permission of
the index files
```sh
sudo chown root ~/.cargo/registry/index/.../.cache/r-
sudo chmod 700 ~/.cargo/registry/index/.../.cache/r-

# in a project that uses the `r-efi` crate
cargo build
```

I wasn't quiet sure about the best way to add a test to the testsuite
for this. 😅
If there is good way to create a test for this lmk
Fixes rust-lang#15048

<!--
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.
-->
This PR contains the following updates:

| Package | Update | Change | Pending |
|---|---|---|---|
| [MSRV:3](https://github.com/rust-lang/rust) | minor | `1.81`
-> `1.82` | `1.84` (+1) |

---

### Release Notes

<details>
<summary>rust-lang/rust (MSRV:3)</summary>

###
[`v1.82`](https://github.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1820-2024-10-17)

[Compare
Source](https://github.com/rust-lang/rust/compare/1.81.0...1.82.0)

\==========================

<a id="1.82.0-Language"></a>

## Language

- [Don't make statement nonterminals match pattern
nonterminals](https://github.com/rust-lang/rust/pull/120221/)
- [Patterns matching empty types can now be omitted in common
cases](https://github.com/rust-lang/rust/pull/122792)
- [Enforce supertrait outlives obligations when using trait
impls](https://github.com/rust-lang/rust/pull/124336)
- [`addr_of(_mut)!` macros and the newly stabilized `&raw (const|mut)`
are now safe to use with all static
items](https://github.com/rust-lang/rust/pull/125834)
- [size_of_val_raw: for length 0 this is safe to
call](https://github.com/rust-lang/rust/pull/126152/)
- [Reorder trait bound modifiers *after* `for<...>` binder in trait
bounds](https://github.com/rust-lang/rust/pull/127054/)
- [Stabilize opaque type precise capturing (RFC
3617)](https://github.com/rust-lang/rust/pull/127672)
- [Stabilize `&raw const` and `&raw mut` operators (RFC
2582)](https://github.com/rust-lang/rust/pull/127679)
- [Stabilize unsafe extern blocks (RFC
3484)](https://github.com/rust-lang/rust/pull/127921)
- [Stabilize nested field access in
`offset_of!`](https://github.com/rust-lang/rust/pull/128284)
- [Do not require `T` to be live when dropping `[T;
0]`](https://github.com/rust-lang/rust/pull/128438)
- [Stabilize `const` operands in inline
assembly](https://github.com/rust-lang/rust/pull/128570)
- [Stabilize floating-point arithmetic in `const
fn`](https://github.com/rust-lang/rust/pull/128596)
- [Stabilize explicit opt-in to unsafe
attributes](https://github.com/rust-lang/rust/pull/128771)
- [Document NaN bit patterns
guarantees](https://github.com/rust-lang/rust/pull/129559)

<a id="1.82.0-Compiler"></a>

## Compiler

- [Promote riscv64gc-unknown-linux-musl to tier
2](https://github.com/rust-lang/rust/pull/122049)
- [Promote Mac Catalyst targets `aarch64-apple-ios-macabi` and
`x86_64-apple-ios-macabi` to Tier 2, and ship them with
rustup](https://github.com/rust-lang/rust/pull/126450)
- [Add tier 3 NuttX based targets for RISC-V and
ARM](https://github.com/rust-lang/rust/pull/127755)
- [Add tier 3 powerpc-unknown-linux-muslspe
target](https://github.com/rust-lang/rust/pull/127905)
- [Improved diagnostics to explain why a pattern is
unreachable](https://github.com/rust-lang/rust/pull/128034)
- [The compiler now triggers the unreachable code warning properly for
async functions that don't return/are `->
!`](https://github.com/rust-lang/rust/pull/128443)
- [Promote `aarch64-apple-darwin` to Tier
1](https://github.com/rust-lang/rust/pull/128592)
- [Add Trusty OS target `aarch64-unknown-trusty` and
`armv7-unknown-trusty` as tier 3
targets](https://github.com/rust-lang/rust/pull/129490)
- [Promote `wasm32-wasip2` to Tier
2.](https://github.com/rust-lang/rust/pull/126967/)

<a id="1.82.0-Libraries"></a>

## Libraries

- [Generalize `{Rc,Arc}::make_mut()` to `Path`, `OsStr`, and
`CStr`.](https://github.com/rust-lang/rust/pull/126877)

<a id="1.82.0-Stabilized-APIs"></a>

## Stabilized APIs

-
[`std::thread::Builder::spawn_unchecked`](https://doc.rust-lang.org/stable/std/thread/struct.Builder.html#method.spawn_unchecked)
-
[`std::str::CharIndices::offset`](https://doc.rust-lang.org/nightly/std/str/struct.CharIndices.html#method.offset)
-
[`std::option::Option::is_none_or`](https://doc.rust-lang.org/nightly/std/option/enum.Option.html#method.is_none_or)
-
[`[T]::is_sorted`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.is_sorted)
-
[`[T]::is_sorted_by`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.is_sorted_by)
-
[`[T]::is_sorted_by_key`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.is_sorted_by_key)
-
[`Iterator::is_sorted`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.is_sorted)
-
[`Iterator::is_sorted_by`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.is_sorted_by)
-
[`Iterator::is_sorted_by_key`](https://doc.rust-lang.org/nightly/std/iter/trait.Iterator.html#method.is_sorted_by_key)
-
[`std::future::Ready::into_inner`](https://doc.rust-lang.org/nightly/std/future/struct.Ready.html#method.into_inner)
-
[`std::iter::repeat_n`](https://doc.rust-lang.org/nightly/std/iter/fn.repeat_n.html)
- [`impl<T: Clone> DoubleEndedIterator for
Take<Repeat<T>>`](https://doc.rust-lang.org/nightly/std/iter/struct.Take.html#impl-DoubleEndedIterator-for-Take%3CRepeat%3CT%3E%3E)
- [`impl<T: Clone> ExactSizeIterator for
Take<Repeat<T>>`](https://doc.rust-lang.org/nightly/std/iter/struct.Take.html#impl-ExactSizeIterator-for-Take%3CRepeat%3CT%3E%3E)
- [`impl<T: Clone> ExactSizeIterator for
Take<RepeatWith<T>>`](https://doc.rust-lang.org/nightly/std/iter/struct.Take.html#impl-ExactSizeIterator-for-Take%3CRepeatWith%3CF%3E%3E)
- [`impl Default for
std::collections::binary_heap::Iter`](https://doc.rust-lang.org/nightly/std/collections/binary_heap/struct.Iter.html#impl-Default-for-Iter%3C'\_,+T%3E)
- [`impl Default for
std::collections::btree_map::RangeMut`](https://doc.rust-lang.org/nightly/std/collections/btree_map/struct.RangeMut.html#impl-Default-for-RangeMut%3C'\_,+K,+V%3E)
- [`impl Default for
std::collections::btree_map::ValuesMut`](https://doc.rust-lang.org/nightly/std/collections/btree_map/struct.ValuesMut.html#impl-Default-for-ValuesMut%3C'\_,+K,+V%3E)
- [`impl Default for
std::collections::vec_deque::Iter`](https://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.Iter.html#impl-Default-for-Iter%3C'\_,+T%3E)
- [`impl Default for
std::collections::vec_deque::IterMut`](https://doc.rust-lang.org/nightly/std/collections/vec_deque/struct.IterMut.html#impl-Default-for-IterMut%3C'\_,+T%3E)
-
[`Rc<T>::new_uninit`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new_uninit)
-
[`Rc<MaybeUninit<T>>::assume_init`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init)
-
[`Rc<[T]>::new_uninit_slice`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.new_uninit_slice)
-
[`Rc<[MaybeUninit<T>]>::assume_init`](https://doc.rust-lang.org/nightly/std/rc/struct.Rc.html#method.assume_init-1)
-
[`Arc<T>::new_uninit`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.new_uninit)
-
[`Arc<MaybeUninit<T>>::assume_init`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init)
-
[`Arc<[T]>::new_uninit_slice`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.new_uninit_slice)
-
[`Arc<[MaybeUninit<T>]>::assume_init`](https://doc.rust-lang.org/nightly/std/sync/struct.Arc.html#method.assume_init-1)
-
[`Box<T>::new_uninit`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_uninit)
-
[`Box<MaybeUninit<T>>::assume_init`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init)
-
[`Box<[T]>::new_uninit_slice`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.new_uninit_slice)
-
[`Box<[MaybeUninit<T>]>::assume_init`](https://doc.rust-lang.org/nightly/std/boxed/struct.Box.html#method.assume_init-1)
-
[`core::arch::x86_64::_bextri_u64`](https://doc.rust-lang.org/stable/core/arch/x86\_64/fn.\_bextri_u64.html)
-
[`core::arch::x86_64::_bextri_u32`](https://doc.rust-lang.org/stable/core/arch/x86\_64/fn.\_bextri_u32.html)
-
[`core::arch::x86::_mm_broadcastsi128_si256`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_mm_broadcastsi128\_si256.html)
-
[`core::arch::x86::_mm256_stream_load_si256`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_mm256\_stream_load_si256.html)
-
[`core::arch::x86::_tzcnt_u16`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_tzcnt_u16.html)
-
[`core::arch::x86::_mm_extracti_si64`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_mm_extracti_si64.html)
-
[`core::arch::x86::_mm_inserti_si64`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_mm_inserti_si64.html)
-
[`core::arch::x86::_mm_storeu_si16`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_mm_storeu_si16.html)
-
[`core::arch::x86::_mm_storeu_si32`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_mm_storeu_si32.html)
-
[`core::arch::x86::_mm_storeu_si64`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_mm_storeu_si64.html)
-
[`core::arch::x86::_mm_loadu_si16`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_mm_loadu_si16.html)
-
[`core::arch::x86::_mm_loadu_si32`](https://doc.rust-lang.org/stable/core/arch/x86/fn.\_mm_loadu_si32.html)
-
[`core::arch::wasm32::u8x16_relaxed_swizzle`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u8x16\_relaxed_swizzle.html)
-
[`core::arch::wasm32::i8x16_relaxed_swizzle`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i8x16\_relaxed_swizzle.html)
-
[`core::arch::wasm32::i32x4_relaxed_trunc_f32x4`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i32x4\_relaxed_trunc_f32x4.html)
-
[`core::arch::wasm32::u32x4_relaxed_trunc_f32x4`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u32x4\_relaxed_trunc_f32x4.html)
-
[`core::arch::wasm32::i32x4_relaxed_trunc_f64x2_zero`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i32x4\_relaxed_trunc_f64x2\_zero.html)
-
[`core::arch::wasm32::u32x4_relaxed_trunc_f64x2_zero`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u32x4\_relaxed_trunc_f64x2\_zero.html)
-
[`core::arch::wasm32::f32x4_relaxed_madd`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f32x4\_relaxed_madd.html)
-
[`core::arch::wasm32::f32x4_relaxed_nmadd`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f32x4\_relaxed_nmadd.html)
-
[`core::arch::wasm32::f64x2_relaxed_madd`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f64x2\_relaxed_madd.html)
-
[`core::arch::wasm32::f64x2_relaxed_nmadd`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f64x2\_relaxed_nmadd.html)
-
[`core::arch::wasm32::i8x16_relaxed_laneselect`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i8x16\_relaxed_laneselect.html)
-
[`core::arch::wasm32::u8x16_relaxed_laneselect`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u8x16\_relaxed_laneselect.html)
-
[`core::arch::wasm32::i16x8_relaxed_laneselect`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i16x8\_relaxed_laneselect.html)
-
[`core::arch::wasm32::u16x8_relaxed_laneselect`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u16x8\_relaxed_laneselect.html)
-
[`core::arch::wasm32::i32x4_relaxed_laneselect`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i32x4\_relaxed_laneselect.html)
-
[`core::arch::wasm32::u32x4_relaxed_laneselect`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u32x4\_relaxed_laneselect.html)
-
[`core::arch::wasm32::i64x2_relaxed_laneselect`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i64x2\_relaxed_laneselect.html)
-
[`core::arch::wasm32::u64x2_relaxed_laneselect`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u64x2\_relaxed_laneselect.html)
-
[`core::arch::wasm32::f32x4_relaxed_min`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f32x4\_relaxed_min.html)
-
[`core::arch::wasm32::f32x4_relaxed_max`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f32x4\_relaxed_max.html)
-
[`core::arch::wasm32::f64x2_relaxed_min`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f64x2\_relaxed_min.html)
-
[`core::arch::wasm32::f64x2_relaxed_max`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.f64x2\_relaxed_max.html)
-
[`core::arch::wasm32::i16x8_relaxed_q15mulr`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i16x8\_relaxed_q15mulr.html)
-
[`core::arch::wasm32::u16x8_relaxed_q15mulr`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u16x8\_relaxed_q15mulr.html)
-
[`core::arch::wasm32::i16x8_relaxed_dot_i8x16_i7x16`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i16x8\_relaxed_dot_i8x16\_i7x16.html)
-
[`core::arch::wasm32::u16x8_relaxed_dot_i8x16_i7x16`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u16x8\_relaxed_dot_i8x16\_i7x16.html)
-
[`core::arch::wasm32::i32x4_relaxed_dot_i8x16_i7x16_add`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.i32x4\_relaxed_dot_i8x16\_i7x16\_add.html)
-
[`core::arch::wasm32::u32x4_relaxed_dot_i8x16_i7x16_add`](https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.u32x4\_relaxed_dot_i8x16\_i7x16\_add.html)

These APIs are now stable in const contexts:

-
[`std::task::Waker::from_raw`](https://doc.rust-lang.org/nightly/std/task/struct.Waker.html#method.from_raw)
-
[`std::task::Context::from_waker`](https://doc.rust-lang.org/nightly/std/task/struct.Context.html#method.from_waker)
-
[`std::task::Context::waker`](https://doc.rust-lang.org/nightly/std/task/struct.Context.html#method.waker)
-
[`{integer}::from_str_radix`](https://doc.rust-lang.org/nightly/std/primitive.u32.html#method.from_str_radix)
-
[`std::num::ParseIntError::kind`](https://doc.rust-lang.org/nightly/std/num/struct.ParseIntError.html#method.kind)

<a id="1.82.0-Cargo"></a>

## Cargo

- [feat: Add `info` cargo
subcommand](https://github.com/rust-lang/cargo/pull/14141/)

<a id="1.82.0-Compatibility-Notes"></a>

## Compatibility Notes

- We now [disallow setting some built-in cfgs via the
command-line](https://github.com/rust-lang/rust/pull/126158)
with the newly added
[`explicit_builtin_cfgs_in_flags`](https://doc.rust-lang.org/rustc/lints/listing/deny-by-default.html#explicit-builtin-cfgs-in-flags)
lint in order to prevent incoherent state, eg. `windows` cfg active but
target is Linux based. The appropriate [`rustc`
flag](https://doc.rust-lang.org/rustc/command-line-arguments.html)
should be used instead.
- The standard library has a new implementation of `binary_search` which
is significantly improves performance
([#&rust-lang#8203;128254](https://github.com/rust-lang/rust/pull/128254)).
However when a sorted slice has multiple values which compare equal, the
new implementation may select a different value among the equal ones
than the old implementation.
- [illumos/Solaris now sets `MSG_NOSIGNAL` when writing to
sockets](https://github.com/rust-lang/rust/pull/128259). This
avoids killing the process with SIGPIPE when writing to a closed socket,
which matches the existing behavior on other UNIX targets.
- [Removes a problematic hack that always passed the --whole-archive
linker flag for tests, which may cause linker errors for code
accidentally relying on
it.](https://github.com/rust-lang/rust/pull/128400)
- The WebAssembly target features `multivalue` and `reference-types` are
now
both enabled by default. These two features both have subtle changes
implied
for generated WebAssembly binaries. For the `multivalue` feature,
WebAssembly
target support has changed when upgrading to LLVM 19. Support for
generating
    functions with multiple returns no longer works and
`-Ctarget-feature=+multivalue` has a different meaning than it did in
LLVM 18
and prior. There is no longer any supported means to generate a module
that has
a function with multiple returns in WebAssembly from Rust source code.
For the
`reference-types` feature the encoding of immediates in the
`call_indirect`, a
commonly used instruction by the WebAssembly backend, has changed.
Validators
and parsers which don't understand the `reference-types` proposal will
no
longer accept modules produced by LLVM due to this change in encoding of
immediates. Additionally these features being enabled are encoded in the
`target_features` custom section and may affect downstream tooling such
as
`wasm-opt` consuming the module. Generating a WebAssembly module that
disables
default features requires `-Zbuild-std` support from Cargo and more
information
    can be found at

[rust-lang/rust#128511](https://github.com/rust-lang/rust/pull/128511).
- [Rust now raises unsafety errors for union patterns in
parameter-position](https://github.com/rust-lang/rust/pull/130531)

<a id="1.82.0-Internal-Changes"></a>

## Internal Changes

These changes do not affect any public interfaces of Rust, but they
represent
significant improvements to the performance or internals of rustc and
related
tools.

- [Update to LLVM
19](https://github.com/rust-lang/rust/pull/127513)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* * * * *" (UTC), Automerge - At any
time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/rust-lang/cargo).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS45Mi4wIiwidXBkYXRlZEluVmVyIjoiMzkuOTIuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciIsImxhYmVscyI6W119-->
### What does this PR try to resolve?

I was reading the docs to see how to specify a version to use from a git
dependency, and came across this section and got really confused as I
did not know what `N.B.` meant so the following did not read well for
me: `N.B. that if ...`. I had to look it up and then realized that I had
wasted time that did not need to be wasted. Thus this PR aims to prevent
the time of future readers from being wasted.

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

Try to read aloud the old version and the new one, as well as the given
alternatives to see which would make most sense to the largest number of
people.

### Additional information

A simple fix would be to just remove "that" as this reads better: `N.B.
if a version doesn't match, Cargo will fail to compile!`

#### Other variations
* `Note that if a version doesn't match, Cargo will fail to compile!`
- might be confused as `Notice that if a version doesn't match, Cargo
will fail to compile!`
* Move the comment out to a reworded sentence right below the code block
and perhaps also link to the [`The role of the version
key`](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#the-role-of-the-version-key)
section above which clearly states:
> The version key does not affect which commit is used when Cargo
retrieves the git dependency, but Cargo checks the version information
in the dependency’s Cargo.toml file against the version key and raises
an error if the check fails.
…ng#14997)

### What does this PR try to resolve?

This revives rust-lang#14962. See benchmark chart in
<rust-lang#14962 (comment)>.
rust-lang#14962 was closed because we found more bugs in `cargo package`, and
rust-lang#14962 could potentially make them even harder to fix. Two of them have
been fixed so this is good to ship IMO with its own good.

---

An improvement rust-lang#14955.

`check_repo_state` checks the entire git repo status. This is usually
fine if you have only a few packages in a workspace.

For huge monorepos, it may hit performance issues.

For example,
on awslabs/aws-sdk-rust@2cbd34d
the workspace has roughly 434 members to publish.
`git ls-files` reported us 204379 files in this Git repository. That
means git may need to check status of all files 434 times. That would be
`204379 * 434 = 88,700,486` checks!

Moreover, the current algorithm is finding the intersection of
`PathSource::list_files` and `git status`.
It is an `O(n^2)` check.
Let's assume files are evenly distributed into each package, so roughly
470 files per package.
If we're unlucky to have some dirty files, say 100 files. We will have
to do `470 * 100 = 47,000` times of path comparisons.

Even worse, because we `git status` everything in the repo, we'll have
to it for all members,
even when those dirty files are not part of the current package in
question. So it becomes `470 * 100 * 434 = 20,398,000`!

#### Solution

Instead of comparing with the status of the entire repository, this
patch use the magic pathspec[1] to tell git only reports paths that
match a certain path prefix.

This wouldn't help the `O(n^2)` algorithm,
but at least it won't check dirty files outside the current package.
Also, we don't `git status` against entire git worktree/index anymore.

[1]:
https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec

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

Run this command against
awslabs/aws-sdk-rust@2cbd34d,
and see if it is getting better.

```
CARGO_LOG_PROFILE=1 cargor package --no-verify --offline --allow-dirty -p aws-sdk-accessanalyzer -p aws-sdk-apigateway
```

I've verified checksums of `.crate` files generated from master
(d85d761) and this commit
(3dabdcd). They are the same.

### Additional information

There are some other alternatives, like making `PathSource::list_files`
additionally reports dirty files. While we already have rooms to do it,
this approach should be the most straightforward one at this moment.

Some other approaches like

* Switch to gitoxide (I tried and it didn't as good as expected. Maybe I
did something wrong).
* A flag `--no-vcs` to skip vcs at all
* Improve the `O(n^2)` algorithm
…cro to trigger rebuilds (rust-lang#15062)

Initially discussed in
https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/env!.2Foption_env!.20are.20tracked.2C.20can.20documentation.20be.20improved.3F/near/491793318

### What does this PR try to resolve?

There is no documentation that I can find which indicates that cargo
will rebuild for changes in the variables used in `env!` macros.

Because this was not always the case, when searching for information on
this, the main result indicates otherwise
https://users.rust-lang.org/t/should-env-cause-rebuild-is-env-var-changes/18013.

Users misled by this may turn to `rerun-if-changed-env` in a build
script to trigger rebuilds, so this documentation is a useful place to
catch users and indicate that it isn't needed for `env!` macros.

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

I'm not sure how to test the new relative link but I matched it to the
existing `[env-macro]: ../../std/macro.env.html`.

My main concern when writing this was whether it was clear that this
applies to `env!` macro usage within the main code of the crate and not
just in `build.rs`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.