[stable] Prepare Rust 1.46.0
Also updated the compatibility notes to account for the regressions we didn't fix for this release. The release team evaluated them, and we agreed they're not enough to block the release.
r? @Mark-Simulacrum
cc @rust-lang/release
[beta] backports
* Fix regionck failure when converting Index to IndexMut #74960
* Update RELEASES.md for 1.46.0 #74744
* allow escaping bound vars when normalizing `ty::Opaque` #75443
r? @ghost
[beta] Make ClashingExternDeclarations Allow by default.
As per https://github.com/rust-lang/rust/pull/73990#issuecomment-666457338, this PR changes `clashing_extern_declarations` to allow-by-default to sidestep current false positives & negatives on the beta branch.
Note that the changes to fix the issue properly have been merged to master (see #73990), but those changes will have to arrive on the next release train.
[beta] backports
* Forbid non-derefable types explicitly in unsizing casts #75136
* forbid `#[track_caller]` on main #75130
* Fix #[track_caller] shims for trait objects. #74784
* rustc_target: Add a target spec option for disabling `--eh-frame-hdr` #74631
* Disable Azure Pipelines except for macOS #74620
* Upload builds from GHA instead of Azure Pipelines #74565
* Add the aarch64-apple-darwin target #74541
* Use `ReEmpty(U0)` as the implicit region bound in typeck #74509
* rustbuild: drop tool::should_install #74457
* lint: use `transparent_newtype_field` to avoid ICE #74340
* Don't panic if the lhs of a div by zero is not statically known #74221
* improper_ctypes_definitions: allow `Box` #74448
* typeck: check for infer before type impls trait #73965
This commit checks that the target type of the cast (an error related
to which is being reported) does not have types to be inferred before
checking if it implements the `From` trait.
Signed-off-by: David Wood <david@davidtw.co>
This commit stops linting against `Box` in `extern "C" fn`s for the
`improper_ctypes_definitions` lint - boxes are documented to be
FFI-safe.
Signed-off-by: David Wood <david@davidtw.co>
This commit re-uses the `transparent_newtype_field` function instead of
manually calling `is_zst` on normalized fields to determine which field
in a transparent type is the non-zero-sized field, thus avoiding an ICE.
Signed-off-by: David Wood <david@davidtw.co>
ci: Set `shell: bash` as a default, remove duplicates
A follow-up to #74406, this commit merely removes the `shell: bash` lines where they were added in favor of setting defaults for *all* "run" steps in the jobs that run the tests.
The changes in #74406 were needed because of an upstream change to the `windows-2019` GitHub Actions image. Previously, the configuration worked fine without specifying `shell: bash`, but for some reason this broke with a new change that was deployed today. The preceding PR was a hotfix to get CI passing, but there was a slightly less duplicative way to specify the default shell for the jobs, which was to set the `defaults.run` option.
This change applies to the `pr`, `try`, `auto`, and `auto-fallible` jobs, which are derived from the YAML-anchor `base-ci-job`. I did not apply these changes to the `master`, `try-success`, `try-failure`, `auto-success`, or `auto-failure` jobs because they have only a few steps.
cc/r? @Mark-Simulacrum
Use step_unchecked more liberally in range iter impls
Without these `_unchecked`, these operations on iterators of `char` fail to optimize out the unreachable panicking condition on overflow.
cc @cuviper https://github.com/rayon-rs/rayon/pull/771 where this was discovered.
Added detailed error code explanation for issue E0688 in Rust compiler.
Added proper error explanation for issue E0688 in the Rust compiler.
Error Code E0688
Sub Part of Issue #61137
r? @GuillaumeGomez
rustdoc: Allow linking from private items to private types
Fixes#74134
After PR #72771 this would trigger an intra_doc_link_resolution_failure warning
when rustdoc is invoked without --document-private-items. Links from private
items to private types are however never actually generated in that case and
thus shouldn't produce a warning. These links are in fact a very useful tool to
document crate internals.
Tests are added for all 4 combinations of public/private items and link
targets. Test 1 is the case mentioned above and fails without this commit. Tests
2 - 4 passed before already but are added nonetheless to prevent regressions.
Fix caching issue when building tools.
This fixes a problem with tool builds not being cached properly.
#73297 changed it so that Clippy will participate in the "deny warnings" setting. Unfortunately this causes a problem because Clippy shares the build directory with other tools which do not participate in "deny warnings". Because Cargo does not independently cache artifacts based on different RUSTFLAGS settings, it causes all the shared dependencies to get rebuilt if Clippy ever gets built.
The solution here is to stop using RUSTFLAGS, and just sneak the settings in through the rustc wrapper. Cargo won't know about the different settings, so it will not bust the cache. This should be safe since lint settings on dependencies are ignored. This is how things used to work in the past before #64316.
Alternate solutions:
* Treat Clippy as a "submodule" and don't enforce warnings on it. This was the behavior before #73297. The consequence is that if a warning sneaks into clippy, that the clippy maintainers will need to fix it when they sync clippy back to the clippy repo.
* Just deny warnings on all tools (removing the in-tree/submodule distinction). This is tempting, but with some issues (cc #52336):
* Adding or changing warnings in rustc can be difficult to land because tools have to be updated if they trip the warning. In practice, this isn't too bad. Cargo (and rustfmt) already runs with `deny(warnings)`, so this has been the de-facto standard already (although they do not use the extra lints like `unused_lifetimes`).
* Teach Cargo to add flags to the workspace members, but not dependencies.
* Teach Cargo to add flags without fingerprinting them?
* Teach Cargo to independently cache different RUSTFLAGS artifacts (this was [reverted](https://github.com/rust-lang/cargo/pull/7417) due to complications). This would also unnecessarily rebuild dependencies, but would avoid cache thrashing.
* Teach Cargo about lint settings.
Closes#74016
Document the union keyword
Partial fix of #34601.
This documents the `union` keyword by presenting three cases: simply using a union, matching on a union and referencing the fields of a union.
@rustbot modify labels: T-doc,C-enhancement