Rollup of 9 pull requests
Successful merges:
- #126822 (Bootstrap command refactoring: port more `Command` usages to `BootstrapCmd` (step 2))
- #126835 (Simplifications in match lowering)
- #126953 (std: separate TLS key creation from TLS access)
- #127045 (Rename `super_predicates_of` and similar queries to `explicit_*` to note that they're not elaborated)
- #127075 (rustc_data_structures: Explicitly check for 64-bit atomics support)
- #127101 (remove redundant match statement from dataflow const prop)
- #127102 (Rename fuchsia builder and bump Fuchsia)
- #127103 (Move binder and polarity parsing into `parse_generic_ty_bound`)
- #127108 (unify `dylib` and `bin_helpers` and create `shared_helpers::parse_value_from_args`)
r? `@ghost`
`@rustbot` modify labels: rollup
unify `dylib` and `bin_helpers` and create `shared_helpers::parse_value_from_args`
`dylib` and `bin_helpers` were already used in similar logic. This PR unifies them under a `shared_helpers` module that is utilized by both the bootstrap library and shims. Additionally, created `parse_value_from_args` with a unit test. This helps avoid code duplication in shims and can also be used in the bootstrap library if needed (which is the case in one of `@Kobzol's` tasks).
r? `@Kobzol`
Move binder and polarity parsing into `parse_generic_ty_bound`
Let's pull out the parts of #127054 which just:
1. Make the parsing code less confusing
2. Fix `?use<>` (to correctly be denied)
3. Improve `T: for<'a> 'a` diagnostics
This should have no user-facing effects on stable parsing.
r? fmease
Rename fuchsia builder and bump Fuchsia
This PR renames the fuchsia builder as requested in https://github.com/rust-lang/rustc-dev-guide/pull/1989#pullrequestreview-2148682346 and bumps Fuchsia.
This includes the quality-of-life improvements for developers in https://fxrev.dev/1061894. It also removes the wasm target, which should speed up the build a little.
The new name of the builder is `x86_64-fuchsia` because I think `x86_64-gnu-fuchsia` would be confusing and put too much emphasis on the host target. (In terms of triples, we are targeting `x86_64-unknown-fuchsia` from `x86_64-unknown-linux-gnu`.) Someone on the infra team should weigh in here.
After this lands, we should update the docs in the rustc-dev-guide again.
cc `@lqd`
r? t-infra
try-job: x86_64-fuchsia
rustc_data_structures: Explicitly check for 64-bit atomics support
Instead of keeping a list of architectures which have native support
for 64-bit atomics, just use #[cfg(target_has_atomic = "64")] and its
inverted counterpart to determine whether we need to use portable
AtomicU64 on the target architecture.
Rename `super_predicates_of` and similar queries to `explicit_*` to note that they're not elaborated
Rename:
* `super_predicates_of` -> `explicit_super_predicates_of`
* `implied_predicates_of` -> `explicit_implied_predicates_of`
* `supertraits_containing_assoc_item` -> `explicit_supertraits_containing_assoc_item`
This makes it clearer that, unlike (for example) [`TyCtxt::super_traits_of`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.super_traits_of), we don't automatically elaborate this set of predicates.
r? ``@lcnr`` or ``@oli-obk`` or someone from t-types idc
std: separate TLS key creation from TLS access
Currently, `std` performs an atomic load to get the OS key on every access to `StaticKey` even when the key is already known. This PR thus replaces `StaticKey` with the platform-specific `get` and `set` function and a new `LazyKey` type that acts as a `LazyLock<Key>`, allowing the reuse of the retreived key for multiple accesses.
Related to #110897.
Bootstrap command refactoring: port more `Command` usages to `BootstrapCmd` (step 2)
This PR moves more of bootstrap to use `BooststrapCmd`, and also refactors the struct to allow it to serve as a proper command wrapper.
Tracking issue: https://github.com/rust-lang/rust/issues/126819
Best reviewed commit-by-commit, I have been adding some helper impls along the way to ease the migration, and then later I remove some of them since they were no longer needed.
r? `@onur-ozkan`
Migrate `unknown-mod-stdin`, `issue-68794-textrel-on-minimal-lib`, `raw-dylib-cross-compilation` and `used-cdylib-macos` `run-make` tests to rmake
Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).
Seriously needs OSX/Windows try-jobs. If it fails, restore `only-linux` in `textrel-on-minimal-lib` and try again.
try-job: x86_64-mingw
try-job: x86_64-msvc
Rollup of 11 pull requests
Successful merges:
- #123714 (Add test for fn pointer duplication.)
- #124091 (Update AST validation module docs)
- #127015 (Switch back `non_local_definitions` lint to allow-by-default)
- #127016 (docs: check if the disambiguator matches its suffix)
- #127029 (Fix Markdown tables in platform-support.md)
- #127032 (Enable const casting for `f16` and `f128`)
- #127055 (Mark Hasher::finish as #[must_use])
- #127068 (Stall computing instance for drop shim until it has no unsubstituted const params)
- #127070 (add () to the marker_impls macro for ConstParamTy)
- #127071 (Remove (deprecated & unstable) {to,from}_bits pointer methods)
- #127078 (Enable full tools and profiler for LoongArch Linux targets)
r? `@ghost`
`@rustbot` modify labels: rollup
Enable full tools and profiler for LoongArch Linux targets
When the LoongArch targets were first introduced, the LLVM support was still immature and various tools were not supported on LoongArch. Nowadays most infra is in place, so it is time to enable them on LoongArch to provide a better experience for users of these targets. Plus, the profiler support is needed by Chromium, so better provide it in the official artifacts.
cc `@heiher`
try-job: dist-loongarch64-linux
try-job: dist-loongarch64-musl
Stall computing instance for drop shim until it has no unsubstituted const params
Do not inline the drop shim for types that still have unsubstituted const params.
## Why?
#127030 ICEs because it tries to inline the drop shim for a type with an unsubstituted const param. In order to generate this shim, this requires calling the drop shim builder, which invokes the trait solver to compute whether constituent types need drop (since we compute if a type is copy to disqualify any `Drop` behavior):
9c3bc805dd/compiler/rustc_mir_dataflow/src/elaborate_drops.rs (L378)
However, since we don't keep the param-env of the instance we resolved the item for, we use the wrong param-env:
9c3bc805dd/compiler/rustc_mir_transform/src/shim.rs (L278)
(which is the param-env of `std::ptr::drop_in_place`)
This param-env is notably missing `ConstParamHasTy` predicates, and since we removed the type from consts in https://github.com/rust-lang/rust/pull/125958, we literally cannot prove these predicates in this (relatively) empty param-env. This currently happens in places like the MIR inliner, but may happen elsewhere such as in lints that resolve terminators.
## What?
We force the inliner to not consider calls for `drop_in_place` for types that have unsubstituted const params.
## So what?
This may negatively affect MIR inlining, but I doubt this matters in practice, and fixes a beta regression, so let's fix it. I will look into approaches for fixing this in a more maintainable way, perhaps delaying the creation of drop shim bodies until codegen (like how intrinsics work).
Enable const casting for `f16` and `f128`
I have an open PR to the Miri repo adding tests for this behavior https://github.com/rust-lang/miri/pull/3688, but that unfortunately hits the ICE path here. The changes seem reasonably low risk that it might be okay to merge separately from the tests, and I tested the result locally against an older version of https://github.com/rust-lang/miri/pull/3688.
Cc ``````@RalfJung``````
Fix Markdown tables in platform-support.md
These table entries have wrong number of columns so the "notes" field is missing from the rendered page. Fix by removing excess empty columns.
docs: check if the disambiguator matches its suffix
Fixes#126986
This PR makes it will not continue resolving when its disambiguator doesn't match the suffix format.
Switch back `non_local_definitions` lint to allow-by-default
This PR switch back (again) the `non_local_definitions` lint to allow-by-default as T-lang is requesting some (major) changes in the lint inner workings in https://github.com/rust-lang/rust/issues/126768#issuecomment-2192634762.
This PR will need to be beta-backported, as the lint is currently warn-by-default in beta.
Update AST validation module docs
Drive-by doc update for AST validation pass:
- Syntax extensions are replaced by proc macros.
- Add rationale for why AST validation pass need to be run
post-expansion and why the pass is needed in the first place.
This was discussed during this week's [rustc-dev-guide reading club](https://rust-lang.zulipchat.com/#narrow/stream/196385-t-compiler.2Fwg-rustc-dev-guide), and the rationale was explained by cc ``````@bjorn3.``````
ignore `llvm::Lld` if lld is not enabled
People are having trouble ([ref. zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/MSVC.20Runtime.20mismatch.20when.20building.20LLD)) when they don't want to build `lld` for their custom distribution tarballs even with `lld = false` in their config.toml. This is because it is not controlled by `lld_enabled` flag. This change ensures that `llvm:Lld` is controlled by lld configuration.
Additionally, `lld = true` is set by default for dist profile, because we have been building it all along and this maintains that behavior.
try-job: x86_64-mingw
When the LoongArch targets were first introduced, the LLVM support was
still immature and various tools were not supported on LoongArch.
Nowadays most infra is in place, so it is time to enable them on
LoongArch to provide a better experience for users of these targets.
Plus, the profiler support is needed by Chromium, so better provide it
in the official artifacts.