about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-08-21Rollup merge of #145627 - compiler-errors:const-supertrait-dyn-compat, ↵Jacob Pratt-11/+75
r=fee1-dead Unconditionally-const supertraits are considered not dyn compatible Let's save some space in the design of const traits by making `dyn Trait` where `trait Trait: const Super` not dyn compatible. Such a trait cannot satisfy `dyn Trait: Trait`; we could in the future make this dyn compatible but *NOT* implement `Trait`, but that's a bit weird and seems like it needs to be independently justified moving forward. Fixes https://github.com/rust-lang/rust/issues/145198 r? fee1-dead
2025-08-21Rollup merge of #145621 - dns2utf8:fix_some_typos, r=petrochenkovJacob Pratt-1/+1
Fix some doc typos Hi all Hope the changes are in the correct repo. If not please point me towards the correct locations. Cheers
2025-08-21Rollup merge of #145593 - RalfJung:unsafepinned-raw_get, r=Mark-SimulacrumJacob Pratt-2/+2
UnsafePinned::raw_get: sync signature with get This was forgotten in https://github.com/rust-lang/rust/pull/142162. Tracking issue: https://github.com/rust-lang/rust/issues/125735.
2025-08-21Rollup merge of #145590 - nnethercote:ModKind-Inline, r=petrochenkovJacob Pratt-25/+28
Prevent impossible combinations in `ast::ModKind`. `ModKind::Loaded` has an `inline` field and a `had_parse_error` field. If the `inline` field is `Inline::Yes` then `had_parse_error` must be `Ok(())`. This commit moves the `had_parse_error` field into the `Inline::No` variant. This makes it impossible to create the nonsensical combination of `inline == Inline::Yes` and `had_parse_error = Err(_)`. r? ```@Urgau```
2025-08-21Rollup merge of #145525 - typesanitizer:vg/doc, r=Mark-SimulacrumJacob Pratt-1/+1
stdlib: Replace typedef -> type alias in doc comment 'typedef' is jargon from C and C++. Since the Rust reference uses the term [type alias](https://doc.rust-lang.org/reference/items/type-aliases.html), this patch changes the doc comment in io/error.rs to also use 'type alias'.
2025-08-21Rollup merge of #145415 - a4lg:riscv-implication-to-c, r=AmanieuJacob Pratt-1/+21
std_detect: RISC-V: implement implication to "C" Just like we implemented relatively complex rules to imply other extensions **from** "C" (and some others), this commit implements implication **to** the "C" extension from others, complying the following text in the ISA Manual (although there's no direct imply/depend references). > The C extension is the superset of the following extensions: > > - Zca > - Zcf if F is specified (RV32 only) > - Zcd if D is specified This is formally verified so that no other extension combinations (*not* in this implementation) can (currently) imply the "C" extension. Note: this is a `std_detect` change and not main target feature handling.
2025-08-21Rollup merge of #145390 - joshtriplett:rustc-diag-value-earlier, r=lcnrJacob Pratt-456/+508
Shorten some dependency chains in the compiler (I recommend reviewing this commit by commit.) One of the long dependency chains in the compiler is: - Many things depend on `rustc_errors`. - `rustc_errors` depended on many things prior to this PR, including `rustc_target`, `rustc_type_ir`, `rustc_hir`, and `rustc_lint_defs`. - `rustc_lint_defs` depended on `rustc_hir` prior to this PR. - `rustc_hir` depends on `rustc_target`. - `rustc_target` is large and takes a while. This PR breaks that chain, through a few steps: - The `IntoDiagArgs` trait, from `rustc_errors`, moves earlier in the dependency chain. This allows `rustc_errors` to stop depending on a pile of crates just to implement `IntoDiagArgs` for their types. - Split `rustc_hir_id` out of `rustc_hir`, so crates that just need `HirId` and similar don't depend on all of `rust_hir` (and thus `rustc_target`). - Make `rustc_lint_defs` stop depending on `rustc_hir`.
2025-08-21Rollup merge of #145297 - adwinwhite:recursive-debuginfo, r=wesleywiserJacob Pratt-16/+47
fix(debuginfo): handle false positives in overflow check Fixes rust-lang/rust#144636. Duplicate wrappers and normal recursive types can lead to false positives. ```rust struct Recursive { a: Box<Box<Recursive>>, } ``` The ADT stack can be: - `Box<Recursive>` - `Recursive` - `Box<Box<Recursive>>` (`Box` now detected as expanding) We can filter them out by tracing the generic arg back through the stack, as true expanding recursive types must have their expanding arg used as generic arg throughout. r? ````@wesleywiser````
2025-08-21Rollup merge of #145256 - GuillaumeGomez:bootstrap-test-codegen-backend, ↵Jacob Pratt-20/+103
r=Kobzol,bjorn3 Add new `--test-codegen-backend` bootstrap option This new bootstrap command line flag allows to do: ```shell ./x.py test tests/ui/intrinsics/panic-uninitialized-zeroed.rs --stage 1 -j8 --test-codegen-backend gcc ``` This is the last step before running it into the CI. Supersedes rust-lang/rust#144687. r? ``````@Kobzol``````
2025-08-21Rollup merge of #144915 - compiler-errors:tail-call-ret-ty-equality, ↵Jacob Pratt-25/+61
r=WaffleLapkin,lcnr Defer tail call ret ty equality to check_tail_calls Fixes rust-lang/rust#144892. Currently the tail call signature check assumes that return types have been accounted for. However, this is not complete for several reasons. Firstly, we were using subtyping instead of equality in the HIR typeck code: https://github.com/rust-lang/rust/blob/e1b9081e699065badfc1a9419ec9566e5c8615c4/compiler/rustc_hir_typeck/src/expr.rs#L1096 We could fix this, but it doesn't really do much for us anyways since HIR typeck doesn't care about regions. That means, secondly, we'd need to fix the terminator type check in MIR typeck to account for variances, since tail call terminators need to relate their arguments invariantly to account for the "signature must be equal" rule. This seems annoying. All of this seems like a lot of work, and we already are *manually* checking argument equality. Let's just extend the `check_tail_calls` to account for mismatches in return types anyways. r? ``````@WaffleLapkin``````
2025-08-21Rollup merge of #144758 - QnJ1c2kNCg:master, r=NoratriebJacob Pratt-6/+6
[Doc] Add links to the various collections Add a few links to the collections mentioned in the module doc for Collections.
2025-08-21Rollup merge of #143383 - fee1-dead-contrib:push-mstmlwuskxyy, r=dtolnayJacob Pratt-4/+4
stabilize `const_array_each_ref` cc rust-lang/rust#133289, needs FCP.
2025-08-20Auto merge of #145259 - nikic:read-only-capture, r=wesleywiserbors-14/+51
Tell LLVM about read-only captures `&Freeze` parameters are not only `readonly` within the function, but any captures of the pointer can also only be used for reads. This can now be encoded using the `captures(address, read_provenance)` attribute.
2025-08-20rustc_hir_id: Add a comment explaining why the crate existsJosh Triplett-0/+2
2025-08-20Eliminate unnecessary dependency from `rustc_traits` to `rustc_hir`Josh Triplett-4/+2
`rustc_traits` only uses `DefId`, which is a re-export from `rustc_span`.
2025-08-20Eliminate unnecessary dependency from `rustc_mir_dataflow` to `rustc_hir`Josh Triplett-4/+2
`rustc_mir_dataflow` only uses `DefId`, which is a re-export from `rustc_span`.
2025-08-20rustc_lint_defs: Eliminate the dependency on `rustc_hir` for `Namespace`Josh Triplett-12/+10
`rustc_lint_defs` uses `rustc_hir` solely for the `Namespace` type, which it only needs the static description from. Use the static description directly, to eliminate the dependency on `rustc_hir`. This reduces a long dependency chain: - Many things depend on `rustc_errors` - `rustc_errors` depends on `rustc_lint_defs` - `rustc_lint_defs` depended on `rustc_hir` prior to this commit - `rustc_hir` depends on `rustc_target`
2025-08-20rustc_lint_defs: Use `DefPathHash` from `rustc_span` rather than `rustc_hir`Josh Triplett-1/+1
2025-08-20Update test output for change to number of cratesJosh Triplett-5/+5
2025-08-20Split `rustc_hir_id` out of `rustc_hir`Josh Triplett-35/+61
Some crates depend on `rustc_hir` but only want `HirId` and similar id types. `rustc_hir` is a heavy dependency, since it pulls in `rustc_target`. Split these types out into their own crate `rustc_hir_id`. This allows `rustc_errors` to drop its direct dependency on `rustc_hir`. (`rustc_errors` still depends on `rustc_hir` indirectly through `rustc_lint_defs`; a subsequent commit will fix that.)
2025-08-20Move `IntoDiagArg` earlier in the dependency chainsJosh Triplett-395/+425
`rustc_errors` depends on numerous crates, solely to implement its `IntoDiagArg` trait on types from those crates. Many crates depend on `rustc_errors`, and it's on the critical path. We can't swap things around to make all of those crates depend on `rustc_errors` instead, because `rustc_errors` would end up in dependency cycles. Instead, move `IntoDiagArg` into `rustc_error_messages`, which has far fewer dependencies, and then have most of these crates depend on `rustc_error_messages`. This allows `rustc_errors` to drop dependencies on several crates, including the large `rustc_target`. (This doesn't fully reduce dependency chains yet, as `rustc_errors` still depends on `rustc_hir` which depends on `rustc_target`. That will get fixed in a subsequent commit.)
2025-08-20Auto merge of #144086 - clubby789:alloc-zeroed, r=nikicbors-0/+36
Pass `alloc-variant-zeroed` to LLVM Makes use of https://github.com/llvm/llvm-project/pull/138299 (once we pull in a version of LLVM with this attribute). ~~Unfortunately also requires https://github.com/llvm/llvm-project/pull/149336 to work.~~ Closes rust-lang/rust#104847
2025-08-20Adjust test to still show miscompileNikita Popov-0/+3
The capture of i in assert_ne!() is now known read-only, which enables early SROA. Block this by passing i to println, where we currently cannot recognize this.
2025-08-20Tell LLVM about read-only capturesNikita Popov-14/+48
`&Freeze` parameters are not only `readonly` within the function, but any captures of the pointer can also only be used for reads. This can now be encoded using the `captures(address, read_provenance)` attribute.
2025-08-20Pass `alloc-variant-zeroed` to LLVMclubby789-0/+36
2025-08-20Unconditionally-const supertraits are considered not dyn compatibleMichael Goulet-11/+75
2025-08-20Auto merge of #145645 - Kobzol:uplift-fix, r=jieyouxubors-9/+82
Fix rustc uplifting (take two) The rustc uplifting logic is really annoying.. https://github.com/rust-lang/rust/pull/145557 was not enough to fix it. Consider https://github.com/rust-lang/rust/issues/145534#issuecomment-3201868888: in this situation, we do a stage3 build of a cross-compiled rustc (it happens because we run `x test --stage 2`, which mistakenly builds a stage3 rustc, but it doesn't matter what casuses it, what matters is that the stage3 build isn't working). Currently, a stage3 cross-compiled build of rustc works like this: 1) stage0 (host) -> stage1 (host) 2) stage1 (host) -> stage2 (host) 3) stage2 (host) -> stage3 (target) The problem is that in the uplifting logic, I assumed that we will have a stage2 (target) rustc available, which we can uplift. And that would indeed be an ideal solution. But currently, we will actually build a stage2 (*host*) rustc, and only then start the cross-compilation. So the uplifting is broken. I spend a couple of hours trying to fix this, and do the uplifting "from the other direction", so that already when we assemble a stage3 rustc, we notice that an uplift should happen, and we only build stage1 (host) rustc, which also helps avoid one needless rustc build. However, this was relatively complicated and would require larger changes that I was not confident landing at this time. So instead I decided to do a much simpler fix, and just disable rustc uplifting when cross-compiling. Since we currently do the `stage2 (host) -> stage3 (target)` step, it should not actually affect stage3 cross-compiled builds in any way (I hope..), and should only affect stage4+ builds, about which I don't really care (the only change there should be more rustc builds). For normal builds, the stage2 host rustc should (hopefully) always be present, so we shouldn't run into this issue. Eventually, I would like to remove rustc uplifting completely. However, `x test --stage 2` on CI still currently builds a stage3 rustc for some reason, and if we removed uplifting completely, even for non-cross-compiled builds, that would cause an additional rustc build, and that's not great. So for now let's just allow uplifting for non-cross-compiled builds. Fixes rust-lang/rust#145534. r? `@jieyouxu`
2025-08-20Split compiletest `--codegen-backend` into two options ↵Guillaume Gomez-17/+33
`--default-codegen-backend` and `--override-codegen-backend`
2025-08-20Add new `--test-codegen-backend` bootstrap optionGuillaume Gomez-8/+75
2025-08-20Auto merge of #145348 - nnethercote:parse_token_tree-speedup-for-uom, ↵bors-6/+23
r=petrochenkov Sometimes skip over tokens in `parse_token_tree`. r? `@petrochenkov`
2025-08-20Disable rustc uplifting during cross-compilationJakub Beránek-9/+6
2025-08-20Auto merge of #145644 - jhpratt:rollup-ypo3zcd, r=jhprattbors-577/+1196
Rollup of 13 pull requests Successful merges: - rust-lang/rust#139357 (Fix parameter order for `_by()` variants of `min` / `max`/ `minmax` in `std::cmp`) - rust-lang/rust#140314 (Rustdoc: typecheck scrape-examples.js) - rust-lang/rust#140794 (mention lint group in default level lint note) - rust-lang/rust#145006 (Clarify EOF handling for `BufRead::skip_until`) - rust-lang/rust#145252 (Demote x86_64-apple-darwin to Tier 2 with host tools) - rust-lang/rust#145359 (Fix bug where `rustdoc-js` tester would not pick the right `search.js` file if there is more than one) - rust-lang/rust#145381 (Implement feature `int_lowest_highest_one` for integer and NonZero types) - rust-lang/rust#145417 (std_detect: RISC-V platform guide documentation) - rust-lang/rust#145531 (Add runtime detection for APX-F and AVX10) - rust-lang/rust#145619 (`std_detect`: Use `rustc-std-workspace-*` to pull in `compiler-builtins`) - rust-lang/rust#145622 (Remove the std workspace patch for `compiler-builtins`) - rust-lang/rust#145623 (Pretty print the name of an future from calling async closure) - rust-lang/rust#145626 (add a fallback implementation for the `prefetch_*` intrinsics ) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-20Rollup merge of #145626 - folkertdev:prefetch-fallback, r=AmanieuJacob Pratt-58/+102
add a fallback implementation for the `prefetch_*` intrinsics related ACP: https://github.com/rust-lang/libs-team/issues/638 The fallback is to just ignore the arguments. That is a valid implementation because this intrinsic is just a hint. I also added the `miri::intrinsic_fallback_is_spec` annotation, so that miri now supports these operations. A prefetch intrinsic call is valid on any pointer. (specifically LLVM guarantees this https://llvm.org/docs/LangRef.html#llvm-prefetch-intrinsic) Next, I made the `LOCALITY` argument a const generic. That argument must be const (otherwise LLVM crashes), but that was not reflected in the type. Finally, with these changes, the intrinsic can be safe and `const` (a prefetch at const evaluation time is just a no-op). cc `@Amanieu` r? `@RalfJung`
2025-08-20Rollup merge of #145623 - compiler-errors:pretty-async-name, r=wesleywiserJacob Pratt-4/+61
Pretty print the name of an future from calling async closure Fixes https://github.com/rust-lang/rust/issues/145606 by introducing a way to customize the path rendering of async closures' futures in the pretty printer API.
2025-08-20Rollup merge of #145622 - tgross35:remove-builtins-patch, r=Mark-SimulacrumJacob Pratt-1/+0
Remove the std workspace patch for `compiler-builtins` All dependencies of `std` have dropped the crates.io dependency on `compiler-builtins`, so this patch is no longer needed. Closes: RUST-142265
2025-08-20Rollup merge of #145619 - joshtriplett:use-the-right-core, r=tgross35Jacob Pratt-4/+4
`std_detect`: Use `rustc-std-workspace-*` to pull in `compiler-builtins` https://github.com/rust-lang/rust/pull/145489 changed `std_detect` to no longer depend on `cfg-if`, which meant it no longer indirectly pulled in `rustc-std-workspace-core` via `cfg-if`. That caused it to no longer depend on `compiler-builtins`. Change `std_detect` to use `rustc-std-workspace-core` and `rustc-std-workspace-alloc`, to integrate with the rustc workspace. This also pulls in `compiler-builtins` via `rustc-std-workspace-core`. Closes: https://github.com/rust-lang/rust/issues/145594
2025-08-20Rollup merge of #145531 - sayantn:detect-apxf-avx10, r=AmanieuJacob Pratt-25/+47
Add runtime detection for APX-F and AVX10 This was missed in rust-lang/rust#139534 and rust-lang/rust#139675 `@rustbot` label O-x86_64 O-x86_32 A-target-feature r? `@Amanieu`
2025-08-20Rollup merge of #145417 - a4lg:riscv-arch-platform-guide-ch2, r=AmanieuJacob Pratt-83/+114
std_detect: RISC-V platform guide documentation This is practically a revert of a revert, making the commit e907456b2e10622ccd854a3bba8d02ce170b5dbb on `stdarch` come around again with minor fixes, enhancements and adjustments. An excerpt from the original commit message follows: Since there's no architectural feature detection on RISC-V (unlike `CPUID` on x86 architectures and some system registers on Arm/AArch64), runtime feature detection entirely depends on the platform-specific facility. As a result, availability of each feature heavily depends on the platform and its version. To help users make a decision for feature checking on a RISC-V system, this commit adds a platform guide with minimum supported platform versions.
2025-08-20Rollup merge of #145381 - Gnurou:int_lowest_highest_one, r=jhprattJacob Pratt-0/+321
Implement feature `int_lowest_highest_one` for integer and NonZero types Tracking issue: rust-lang/rust#145203 Implement the accepted ACP rust-lang/rust#145203 for methods that find the index of the least significant (lowest) and most significant (highest) set bit in an integer for signed, unsigned, and NonZero types. Also add unit tests for all these types.
2025-08-20Rollup merge of #145359 - GuillaumeGomez:correctly-pick-search.js, ↵Jacob Pratt-2/+20
r=lolbinarycat Fix bug where `rustdoc-js` tester would not pick the right `search.js` file if there is more than one It happened to me quite a few times recently when I worked on the search index: 1. I make a change in search.js 2. I run `rustdoc-js` tests 3. nothing changes So my solution was to simply remove the folder, but it's really suboptimal. With this PR, it now picks the most recently modified file. cc ```@lolbinarycat```
2025-08-20Rollup merge of #145252 - shepmaster:demote-x86_64-apple-darwin-to-tier-2, ↵Jacob Pratt-34/+22
r=Kobzol,madsmtm Demote x86_64-apple-darwin to Tier 2 with host tools Switch to only using aarch64 runners (implying we are now cross-compiling) and stop running tests. In the future, we could enable (some?) tests via Rosetta 2. This implements the decision from https://github.com/rust-lang/rfcs/pull/3841.
2025-08-20Rollup merge of #145006 - ginnyTheCat:docs-skip-until, r=ibraheemdevJacob Pratt-2/+7
Clarify EOF handling for `BufRead::skip_until` This aligns `BufRead::skip_until`'s description more with `BufRead::read_until` in terms of how it handles EOF and extends the doctest to include this behavior.
2025-08-20Rollup merge of #140794 - karolzwolak:allow-unused-doc-65464, r=davidtwcoJacob Pratt-350/+443
mention lint group in default level lint note ### Summary This PR updates lint diagnostics so that default-level notes now mention the lint group they belong to, if any. Fixes: rust-lang/rust#65464. ### Example ```rust fn main() { let x = 5; } ``` Before: ``` = note: `#[warn(unused_variables)]` on by default ``` After: ``` = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default ``` ### Unchanged Cases Messages remain the same when the lint level is explicitly set, e.g.: * Attribute on the lint `#[warn(unused_variables)]`: ``` note: the lint level is defined here LL | #[warn(unused_variables)] | ^^^^^^^^^^^^^^^^ ``` * Attribute on the group `#[warn(unused)]:`: ``` = note: `#[warn(unused_variables)]` implied by `#[warn(unused)]` ``` * CLI option `-W unused`: ``` = note: `-W unused-variables` implied by `-W unused` = help: to override `-W unused` add `#[allow(unused_variables)]` ``` * CLI option `-W unused-variables`: ``` = note: requested on the command line with `-W unused-variables` ```
2025-08-20Rollup merge of #140314 - lolbinarycat:rustdoc-js-scrape-examples-typecheck, ↵Jacob Pratt-11/+43
r=notriddle Rustdoc: typecheck scrape-examples.js more typechecking progress, this time we're mostly held back by the fact that `document.querySelectorAll` can't return nice types if its given a compound query (see the issue linked in a code comment). Additionally, it seems like the generated `data-locs` attribute has fields that are never used by anything? r? ```@notriddle```
2025-08-20Rollup merge of #139357 - miried:master, r=AmanieuJacob Pratt-3/+12
Fix parameter order for `_by()` variants of `min` / `max`/ `minmax` in `std::cmp` We saw a regression introduced in version `1.86` that seems to be coming from switching the order of `v1` and `v2` when calling `comparison` functions in `min_by` / `max_by` / `minmax_by` (cf. this PR: https://github.com/rust-lang/rust/pull/136307) When the `compare` function is not symmetric in the arguments, this leads to false results. Apparently, the test cases do not cover this scenario currently. While asymmetric comparison may be an edge case, but current behavior is unexpected nevertheless.
2025-08-19Auto merge of #145601 - jieyouxu:rollup-t5mbqhc, r=jieyouxubors-133/+127
Rollup of 10 pull requests Successful merges: - rust-lang/rust#145538 (bufreader::Buffer::backshift: don't move the uninit bytes) - rust-lang/rust#145542 (triagebot: Don't warn no-mentions on subtree updates) - rust-lang/rust#145549 (Update rust maintainers in openharmony.md) - rust-lang/rust#145550 (Avoid using `()` in `derive(From)` output.) - rust-lang/rust#145556 (Allow stability attributes on extern crates) - rust-lang/rust#145560 (Remove unused `PartialOrd`/`Ord` from bootstrap) - rust-lang/rust#145568 (ignore frontmatters in `TokenStream::new`) - rust-lang/rust#145571 (remove myself from some adhoc-groups and pings) - rust-lang/rust#145576 (Add change tracker entry for `--timings`) - rust-lang/rust#145578 (Add VEXos "linked files" support to `armv7a-vex-v5`) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-20make `prefetch` intrinsics safeFolkert de Vries-72/+70
2025-08-19Fix some doc typosStefan Schindler-2/+2
2025-08-19Add snapshot tests for stage 3 compiler buildsJakub Beránek-0/+76
2025-08-19Defer tail call ret ty equality to check_tail_callsMichael Goulet-25/+61