[beta] Clippy backport
r? `@Mark-Simulacrum`
Really small backport this time:
- https://github.com/rust-lang/rust-clippy/pull/12961
Fixes a quite annoying bug of this lint, that got into the last stable release 1.79.0. There were already 3 issues opened about it in the Clippy repo. It would be great to get this fixed for the next stable release.
I confirmed that this commit is already part of `master`
Don't allow unsafe statics outside of extern blocks (beta version)
This PR fixes a regression where we allowed `unsafe static` items in top-level modules (i.e. outside of `unsafe extern` blocks).
#127943 does not rebase cleanly, so I've prepared an extremely pared down version of this PR for beta purposes.
Fix incorrect suggestion for `manual_unwrap_or_default`
Fixes#12928.
If this not a "simple" pattern, better not emit the lint.
changelog: Fix incorrect suggestion for `manual_unwrap_or_default`
binutils 2.40 is required by LLVM 19, as older versions do not
know about the zmmull extension.
I've had to backport some patches to glibc and gcc as well,
as they don't build with binutils 2.40. Alternatively, we could
also switch to glibc 2.35 and gcc 12 (I think). I figured we'd
want to avoid the glibc version change, but if that's fine for
riscv I can go with that instead.
[beta] backports
- Properly gate `safe` keyword in pre-expansion #126757
- Switch back `non_local_definitions` lint to allow-by-default #127015
- Stall computing instance for drop shim until it has no unsubstituted const params #127068
- Update LLVM submodule #127190
- Change to the NetBSD archive URL rather than the CDN #127232
r? cuviper
The CDN has been down for a few hours. Switch to an alternative for the
time being so we can unblock CI.
It appears that the CDN is quite a bit faster, so we will likely want to
switch back when available.
(cherry picked from commit 42ac903f4f)
as request T-lang is requesting some major changes in the lint inner
workings in #126768#issuecomment-2192634762
(cherry picked from commit 0c0dfb88ee)
[beta] backports
- Only compute `specializes` query if (min)specialization is enabled in the crate of the specializing impl #126139
- Add pub struct with allow(dead_code) into worklist #126315
- ci: Update centos:7 to use vault repos #126352
r? cuviper
CentOS 7 is going EOL on June 30, after which its package repos will no
longer exist on the regular mirrors. We'll still be able to access
packages from the vault server though, and can start doing so now. This
affects `dist-i686-linux` and `dist-x86_64-linux`.
I also removed `epel-release` because we were only using that for its
`cmake3`, but we've been building our own version for a while.
(cherry picked from commit 6d2493bf5d)
[beta] backports and stage0 bump
- Bump stage0 to 1.79.0
- Do not define opaque types when selecting impls #126258
- Remove failing GUI test to stop blocking CI until it is fixed#126445
r? cuviper
[beta] Ensure self-contained linker is only enabled on dev/nightly
It seems the self-contained linker is enabled on beta. Let's fix that.
```console
$ cargo clean && cargo +beta build && readelf -p .comment target/debug/helloworld
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
String dump of section '.comment':
[ 0] Linker: LLD 18.1.7
[ 14] GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
[ 3f] rustc version 1.80.0-beta.1 (75ac3b633 2024-06-10)
```
I will open a PR to fix it on master as well, right after I test CI's behavior on beta.
Rollup of 11 pull requests
Successful merges:
- #124012 (Stabilize `binary_heap_as_slice`)
- #124214 (Parse unsafe attributes)
- #125572 (Detect pub structs never constructed and unused associated constants)
- #125781 (prefer `compile::stream_cargo` for building tools)
- #126030 (Update `./x fmt` command in library/std/src/sys/pal/windows/c/README.md)
- #126047 (Simplify the rayon calls in the installer)
- #126052 (More `rustc_parse` cleanups)
- #126077 (Revert "Use the HIR instead of mir_keys for determining whether something will have a MIR body.")
- #126089 (Stabilize Option::take_if)
- #126112 (Clean up source root in run-make tests)
- #126119 (Improve docs for using custom paths with `--emit`)
r? `@ghost`
`@rustbot` modify labels: rollup
Improve docs for using custom paths with `--emit`
Recently I found myself concluding that this feature didn't exist (https://github.com/rust-lang/rust/pull/126111#discussion_r1630707215), despite having read the documentation, because it was hidden away in the middle of a paragraph full of other information.
Giving this documentation more space of its own should make it easier to find.
Clean up source root in run-make tests
The name `S` isn't exactly the most descriptive, and we also shouldn't need to pass it when building (actually I think that most of the env. vars that we pass to `cargo` here are probably not really needed).
Related issue: https://github.com/rust-lang/rust/issues/126071
r? ```@jieyouxu```
Revert "Use the HIR instead of mir_keys for determining whether something will have a MIR body."
This reverts commit e5cba17b84.
turns out SMIR still needs it (https://github.com/model-checking/kani/issues/3218). I'll create a full plan and MCP for what I intended this to be a part of. Maybe my plan is nonsense anyway.
prefer `compile::stream_cargo` for building tools
Previously, we were running bare commands for `ToolBuild` step and were unable to utilize some of the flags which are already handled by `compile::stream_cargo`.
This change makes `ToolBuild` to use `compile::stream_cargo`, allowing us to benefit from the flags supported by the bootstrap cargo.
Resolves#125666
Detect pub structs never constructed and unused associated constants
<!--
If this PR is related to an unstable feature or an otherwise tracked effort,
please link to the relevant tracking issue here. If you don't know of a related
tracking issue or there are none, feel free to ignore this.
This PR will get automatically assigned to a reviewer. In case you would like
a specific user to review your work, you can assign it to them by using
r? <reviewer name>
-->
Lints never constructed public structs.
If we don't provide public methods to construct public structs with private fields, and don't construct them in the local crate. They would be never constructed. So that we can detect such public structs.
---
Update:
Also lints unused associated constants in traits.
Parse unsafe attributes
Initial parse implementation for #123757
This is the initial work to parse unsafe attributes, which is represented as an extra `unsafety` field in `MetaItem` and `AttrItem`. There's two areas in the code where it appears that parsing is done manually and not using the parser stuff, and I'm not sure how I'm supposed to thread the change there.
rustdoc: Refactor doctest collection and running code
This code previously had a quite confusing structure, mixing the collection,
processing, and running of doctests with multiple layers of indirection. There
are also many cases where tons of parameters are passed to functions with little
typing information (e.g., booleans or strings are often used).
As a result, the source of bugs is obfuscated (e.g. #81070) and large changes
(e.g. #123974) become unnecessarily complicated. This PR is a first step to try
to simplify the code and make it easier to follow and less bug-prone.
r? `@GuillaumeGomez`