Rollup of 25 pull requests
Successful merges:
- rust-lang/rust#158147 (std: fix stack buffer overflow in Windows junction_point)
- rust-lang/rust#160130 (Select cache values to verify by key fingerprint, not value fingerprint)
- rust-lang/rust#160343 (Rename `OutlivesPredicate` to `OutlivesClause`)
- rust-lang/rust#160360 (Remove rustc_middle dependency on rustc_hir_pretty)
- rust-lang/rust#160387 (rustc_codegen_ssa: Correctly apply the static `--jobs-backend` limit to backend parallelism)
- rust-lang/rust#160422 (move mir-opt miri tests to CI logic)
- rust-lang/rust#160444 (Avoid resolving path keywords outside `TypeNS`)
- rust-lang/rust#160510 (Resolver: (un)tracked borrows for `CmRefCell` made safe by unsafe speculative flag)
- rust-lang/rust#155424 ([blocked] Link to proposed LLM policy in CONTRIBUTING and pull request template)
- rust-lang/rust#158726 (std: move futex implementations into sys::sync::futex)
- rust-lang/rust#158762 (Emit thumb code on VEX V5)
- rust-lang/rust#159225 (Split IncrCompSession out of Session)
- rust-lang/rust#159820 (Make the `rustc_unsafe_specialization_marker` attribute actually `unsafe`)
- rust-lang/rust#160198 (Rework `smallest_range_containing` to handle duplicates)
- rust-lang/rust#160362 (Split `SpannedTypeVisitor` into its own crate, `rustc_ty_walk`)
- rust-lang/rust#160390 (autodiff: Handle slice-tailed DSTs in type trees)
- rust-lang/rust#160420 (Suggest `cast_signed()` for overflowing signed integer literals)
- rust-lang/rust#160501 (Add bootstrap CLI snapshot test for testing miri)
- rust-lang/rust#160516 (Add regression test for HRTB projection in closure)
- rust-lang/rust#160520 (Add some tests for specialization)
- rust-lang/rust#160522 (fix(bootstrap): Normalize the names of proc macro dependency crates)
- rust-lang/rust#160523 (Add regression test for opaque type)
- rust-lang/rust#160531 (docs: fix typo in AllowExprMetavar comment)
- rust-lang/rust#160538 (Update expect messages in tcp.rs doc examples to follow the style guide)
- rust-lang/rust#160548 (bootstrap: Register `coverage-map` and `coverage-run` aliases via a separate step)
Split `SpannedTypeVisitor` into its own crate, `rustc_ty_walk`
`rustc_privacy` pulls in all of `rustc_ty_utils`, but only wants `SpannedTypeVisitor` and `walk_types`. Move those to a small `rustc_ty_walk` crate.
This allows `rustc_privacy` to start building much sooner.
Type fallback refactorings
- Don't merge different kinds of infer variables into `Ty` before matching them back
- Do fallback only on root vars (this is semantically equivalent to what we currently do; unifying any of the infer vars from the same equivalence class necesserily affects all of them) (this makes https://github.com/rust-lang/rust/pull/159003 a bit less hacky though)
- Do some simplification that has been allowed by the previous changes
cc @lcnr
There is a `impl PpAnn for TyCtxt` that is unneeded. None of the big crates (middle, trait_selection) actually do any hir pretty printing so it can be removed and can either be implemented for local structs elsewhere or done by casting to `&dyn PpAnn` instead.
`rustc_privacy` pulls in all of `rustc_ty_utils`, but only wants
`SpannedTypeVisitor` and `walk_types`. Move those to a small
`rustc_ty_walk` crate.
This allows `rustc_privacy` to start building much sooner.
bootstrap: Move some shared source files into a new `shim_utils` crate
Bootstrap's `rustc` and `rustdoc` shims are mostly self-contained, but they do share some code with each other or with other bootstrap tools.
Historically that sharing was achieved using `#[path]` attributes pointing to the shared files. That's unusual, making the code harder to navigate, and making dependencies and warnings harder to manage. It also causes problems for rust-analyzer, which currently struggles with source files outside the crate root.
This PR therefore takes two such source files, and moves them into a new `shim_utils` crate, which can then be used as a normal crate-path dependency. That new crate is separate from the existing `build_helper` crate, since that crate contains other code that is not of interest to the shims specifically.
Former paths of the files that have been moved:
- `src/bootstrap/src/utils/shared_helpers.rs`
- `src/build_helper/src/arg_file_command.rs`
---
Relevant PRs that created these shared source files:
- https://github.com/rust-lang/rust/pull/127108
- https://github.com/rust-lang/rust/pull/155439
---
r? Kobzol (or bootstrap)
Bump thorin-dwp (0.10), gimli (0.33), and object (0.38.1)
Originally, the hope was that this would reduce duplication of `object` within the compiler.
In practice, it turns out that this merely bumps the object major-version-set from {0.36, 0.37} to {0.37, 0.38}.
(The holdout for object@0.37 is `ar_archive_writer`, which does have a newer release available. But that would end up pulling in object@0.39 instead.)
There is still an object@0.36 entry in Cargo.lock, but that comes via `ui_test` which is a dev-dependency for clippy and miri.
Bootstrap's `rustc` and `rustdoc` shims are mostly self-contained, but they do
share some code with each other or with other bootstrap tools.
Historically that sharing was achieved using `#[path]` attributes pointing to
the shared files. That's unusual, making the code harder to navigate, and
making dependencies and warnings harder to manage. It also causes problems for
rust-analyzer, which currently struggles with source files outside the crate
root.
This PR therefore takes two such source files, and moves them into a new
`shim_utils` crate, which can then be used as a normal crate-path dependency.
That new crate is separate from the existing `build_helper` crate, since that
crate contains other code that is not of interest to the shims specifically.
Former paths of the files that have been moved:
- `src/bootstrap/src/utils/shared_helpers.rs`
- `src/build_helper/src/arg_file_command.rs`
`rustc_borrowck` now only uses `rustc_traits` for one helper that it
re-exports from `rustc_trait_selection`. Use the helper directly from
`rustc_trait_selection`, and eliminate the dependency.
Remove itertools dependency from `rustc_ast_pretty`
3 Second optimization in the `rustc_ast_pretty` module compiletimes (13.57s -> 10.58s)! Not much, but it's honest work :)
Found by an experiment I'm doing, related with Incremental Systems Rethought project goal.
So, cc https://github.com/rust-lang/rust-project-goals/issues/641
r? @jackh726
`PendingObligations` is a `ThinVec` containing a pair
`(PredicateObligation<'tcx>, Option<GoalStalledOn<TyCtxt<'tcx>>>)`. This
pair is currently 136 bytes. This is more than 128 bytes, which means
that LLVM uses (slow) `memcpy` to move the elements.
This commit shrinks `GoalStalledOn` by changing its two `Vec` fields to
`ThinVec`. This shrinks the pair from 136 bytes to 104 bytes, under the
`memcpy` threshold.
The use of `ThinVec` in `GoalStalledOn` forces us to use `ThinVec` in a
number of other places. Some of these required the thin-vec `unstable`
feature for `may_dangle` support.
The commit also adds some size assertions, to prevent backsliding.
Update thinvec to 0.2.19
It contains `may_dangle` Drop impl under a feature flag. This allows us to use it in a lot more places, notable in types that hold `&'tcx` references. This would previously fail in borrowck in arena code.
We have to enable its "unstable" feature for this. That also enables `TrustedLen` impl, which is behind unstable flag, too. I left the flag disabled, because it regressed next-solver benchmarks, but that will be fixed in PR that needs this flag (see the comment: https://github.com/rust-lang/rust/pull/159974#issuecomment-5091132427)
Support using const pointers in asm `const` operand
Implements [RFC#3848](https://github.com/rust-lang/rfcs/pull/3848) with tracking issue rust-lang/rust#128464
This adds support of const pointers for asm `const` in addition to plain integers.
The inline `asm!` support is implemented using `i` constraint, and the `global_asm!` and `naked_asm!` support is implemented by inserting `symbol + offset` and make `symbol` compiler-used. For unnamed consts, it will create additional internal & hidden symbols so that they can be referenced by global_asm.
~~The feature is also implemented for GCC backend but it's untested.~~ Tested now.
Apply RemoveNoopLandingPads post-monomorphization
On Cargo this cuts ~5% of the LLVM IR lines we generate (measured with -Cno-prepopulate-passes).
Closes https://github.com/rust-lang/rust/issues/159399.
This speeds up LLVM and improves codegen overall. As an example, for
cargo this cuts ~5% of the LLVM IR lines we generate (measured with
-Cno-prepopulate-passes).
Port compiletest's CLI to clap
Suggested this in https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/compiletest.20CLI.20parsing/with/609693929.
My main motivation was to separate CLI arguments and the `Config` structure, because we derive a lot of non-CLI data for the latter struct, but before it was too tied to the CLI.
This PR is the first step towards that, in follow-up PRs I will clean up the `Config`.
The move itself was *very* boilerplate-y, so I decided to use Claude to perform the mechanical port (the first commit).
Then I went through all the flags, checked that they correspond to the old ones and should be parseable by clap.
I also did some light cleanups to remove extra parsing there.
This is in the second commit (no AI was involved in that).
This PR increases the dependency count of `compiletest` by 4. I think that's fine, and on CI it should be cached by `sccache` anyway.
r? @jieyouxu