Commit graph

317582 commits

Author SHA1 Message Date
reddevilmidzy
abca0d5f74 Move dynamically-sized-types tests into dst dir 2026-02-15 04:38:12 +00:00
bors
56aaf58ec0 Auto merge of #152253 - nxsaken:stable_const_control_flow, r=dtolnay
Stabilize const ControlFlow predicates


Tracking issue: rust-lang/rust#148738
Related: rust-lang/rust#140266 (moved the relevant const-unstables to that feature)
r? @dtolnay
2026-02-07 03:40:48 +00:00
bors
c58d9f9f82 Auto merge of #152264 - JonathanBrouwer:rollup-pBsxN9G, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#152126 (Convert to inline diagnostics in `rustc_mir_build`)
 - rust-lang/rust#152186 (Convert to inline diagnostics in `rustc_const_eval`)
 - rust-lang/rust#152234 (Dont strip const blocks in array lengths)
 - rust-lang/rust#152243 (Use relative paths for std links in rustc-docs)
2026-02-07 00:31:58 +00:00
Jonathan Brouwer
7f514e2f57
Rollup merge of #152243 - arferreira:fix-rustc-docs-local, r=GuillaumeGomez
Use relative paths for std links in rustc-docs

Fixes rust-lang/rust#151496

This adds `--extern-html-root-url` for each `STD_PUBLIC_CRATES` entry pointing to `../`, so that `rustc-docs` links to the locally installed `rust-docs` via relative paths.

r? @GuillaumeGomez @rami3l
2026-02-07 01:18:54 +01:00
Jonathan Brouwer
98ae26c830
Rollup merge of #152234 - BoxyUwU:dont_strip_const_blocks, r=oli-obk
Dont strip const blocks in array lengths

r? oli-obk

mGCA now handles const blocks by *always* handling them during `lower_expr_to_const_arg_direct` instead of *sometimes* stripping them out at parse time. This is just generally a lot clearer/nicer but also means parsing isn't lossy which is just straight up wrong.

We now use `MgcaDisambiguation::Direct` for const blocks because we "directly" represent a const block as `hir::ConstArgKind::Anon` :> The only time that an anon const for const generics uses `MgcaDisambiguation::AnonConst` is for unbraced literals.

Once we properly support literals in `hir::ConstArgKind` (see rust-lang/rust#152139 rust-lang/rust#152001) then `MgcaDisambiguation` can be renamed to `AnonConstKind` with `TypeSystem` and `NonTypeSystem` variants. We can also get rid of `mgca_direct_lit_hack`. I expect this to be a very nice cleanup :)

Fixes rust-lang/rustfmt#6788

The diff relating to passing spans around is to avoid a bunch of mGCA diagnostics changing from  `const {}` to `{}`. I'm not entirely sure why this was happening.

cc @rust-lang/rustfmt

How do I run the tests in the rustfmt repo from here? `x test rustfmt` only seems to run like 100 tests and doesn't result in a `target/issue-6788.rs` getting created. I've verified locally that this formats correctly though
2026-02-07 01:18:54 +01:00
Jonathan Brouwer
a66d0f8598
Rollup merge of #152186 - GuillaumeGomez:inline-diag-rustc_const_eval, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_const_eval`

Part of rust-lang/rust#151366.

r? @JonathanBrouwer
2026-02-07 01:18:53 +01:00
Jonathan Brouwer
4fa1cdb455
Rollup merge of #152126 - GuillaumeGomez:inline-diag-rustc_mir_build, r=JonathanBrouwer
Convert to inline diagnostics in `rustc_mir_build`

Part of https://github.com/rust-lang/rust/issues/151366.

r? @JonathanBrouwer
2026-02-07 01:18:53 +01:00
Guillaume Gomez
c6829020b0 Convert to inline diagnostics in rustc_const_eval 2026-02-06 22:55:58 +01:00
Guillaume Gomez
885a8081c4 Convert to inline diagnostics in rustc_mir_build 2026-02-06 22:21:27 +01:00
nxsaken
4b427b2f33 Stabilize const ControlFlow predicates 2026-02-07 00:33:52 +04:00
Boxy
a86cfbbaab keep const blocks around 2026-02-06 19:36:39 +00:00
bors
efc9e1b50c Auto merge of #152239 - JonathanBrouwer:rollup-2BolGX5, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#152129 (MGCA: require #[type_const] on free consts too)
 - rust-lang/rust#152139 (mGCA: Support directly represented negated literals)
 - rust-lang/rust#152189 (Convert to inline diagnostics in `rustc_passes`)
2026-02-06 18:42:38 +00:00
arferreira
dcfc23abe4 Use relative paths for std links in rustc-docs
Signed-off-by: arferreira <arfs.antonio@gmail.com>
2026-02-06 12:41:01 -05:00
Jonathan Brouwer
ce8d09b268
Rollup merge of #152189 - JonathanBrouwer:convert_passes, r=lqd
Convert to inline diagnostics in `rustc_passes`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 18:04:41 +01:00
Jonathan Brouwer
30bbeae0a5
Rollup merge of #152139 - khyperia:mgca-negative-literals, r=BoxyUwU
mGCA: Support directly represented negated literals

fixes rust-lang/rust#152123

PatExprKind already awkwardly tacks on a `negated: bool` for the same purpose:

8bccf1224d/compiler/rustc_hir/src/hir.rs (L1954-L1959)

perhaps one day we should indeed do that FIXME...

r? @BoxyUwU
2026-02-06 18:04:40 +01:00
Jonathan Brouwer
144bdf77d1
Rollup merge of #152129 - khyperia:require-type_const-on-free-consts, r=BoxyUwU
MGCA: require #[type_const] on free consts too

When investigating another issue, I discovered that following ICEs (the `const_of_item` query doesn't support non-type_const-marked constants and does a `span_delayed_bug`):

```rust
#![feature(min_generic_const_args)]
#![allow(incomplete_features)]

const N: usize = 4;

fn main() {
    let x = [(); N];
}
```

My initial thought of "only require `#[type_const]` on places that stable doesn't currently accept" ran into the issue of this compiling on stable today:

```rust
trait Trait {
    const N: usize;
}

impl<const PARAM: usize> Trait for [(); PARAM] {
    const N: usize = PARAM;
}

fn main() {
    let x = [(); <[(); 4] as Trait>::N];
}
```

Figuring out which specific cases are not currently accepted by stable is quite hairy.

Upon discussion with @BoxyUwU, she suggested that *all* consts, including free consts, should require `#[type_const]` to be able to be referred to. This is what this PR does.

---

~~The change to `tests/ui/const-generics/generic_const_exprs/non-local-const.rs` is unfortunate, reverting the fix in https://github.com/rust-lang/rust/pull/143106 no longer fails the test. Any suggestions to test it more appropriately would be most welcome!~~

edit: never mind, figured out how compiletests work :) - verified that the new test setup correctly ICEs when that PR's fix is reverted.

r? @BoxyUwU
2026-02-06 18:04:39 +01:00
bors
bce89b6a56 Auto merge of #152230 - JonathanBrouwer:rollup-de59XEq, r=JonathanBrouwer
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#151590 (cmse: don't use `BackendRepr` when checking return type)
 - rust-lang/rust#151945 (feat: Add `NonZero::<T>::from_str_radix`)
 - rust-lang/rust#152000 (Fix ICE in normalizing inherent associated consts with `#[type_const]`)
 - rust-lang/rust#152192 (Always use Xcode-provided Clang in macOS CI)
 - rust-lang/rust#152196 (bootstrap: Remove `ShouldRun::paths`)
 - rust-lang/rust#152222 (Re-add TaKO8Ki to triagebot review queue)
2026-02-06 15:32:38 +00:00
khyperia
e6f5b97152 MGCA: require #[type_const] on free consts too 2026-02-06 15:35:18 +01:00
Jonathan Brouwer
4ae29f946a
Rollup merge of #152222 - TaKO8Ki:add-tako8ki-to-triagebot, r=davidtwco
Re-add TaKO8Ki to triagebot review queue

I’m rejoining the compiler review rotation to help with ongoing review load.
2026-02-06 15:33:41 +01:00
Jonathan Brouwer
ad5b312fbd
Rollup merge of #152196 - jyn514:remove-paths, r=Zalathar
bootstrap: Remove `ShouldRun::paths`

Split out from https://github.com/rust-lang/rust/pull/151930. I've copied my comment in https://github.com/rust-lang/rust/pull/151930#discussion_r2750409129 into the commit description.

r? @Zalathar cc @Mark-Simulacrum @Kobzol

---

Some history about `paths()`. The original intent @Mark-Simulacrum had
when he introduced PathSet in f104b12059, to my knowledge, was that multiple paths
could be aliases for the same step. That's what rustdoc is doing; both
paths for rustdoc run exactly the same Step, regardless of whether one
or both are present.

That never really caught on. To my knowledge, rustdoc is the only usage
of paths() there's ever been.

Later, in rust-lang/rust#95503, I repurposed PathSet to mean "each crate in this set
should be passed to Step::make_run in RunConfig". That was not the
previous meaning.

Rustdoc never looks at run.paths in make_run, so it's safe to just treat
it as an alias, like elsewhere in bootstrap. Same for all the other tool
steps.
2026-02-06 15:33:41 +01:00
Jonathan Brouwer
5372fab729
Rollup merge of #152192 - madsmtm:remove-use-xcode-clang, r=shepmaster
Always use Xcode-provided Clang in macOS CI

Most of our macOS CI runners use the Xcode-provided Clang. `dist-apple-various` still downloads Clang from LLVM's prebuilt sources, which is a bit problematic, because we're still using the Xcode-provided _headers_.

As a concrete example, using Xcode's Clang is required by https://github.com/rust-lang/rust/pull/152013, as otherwise updating to Xcode 26 headers fails with an obscure `fatal error: 'net/route.h' file not found`, see [this build log](https://github.com/rust-lang/rust/pull/152013#issuecomment-3838801617). I suspect this is because building the new headers isn't officially supported with the older LLVM/Clang 15.

This PR removes that functionality, so that we instead always build with the Xcode-provided Clang. This is effectively the same as setting `USE_XCODE_CLANG=1` on `dist-apple-various` as well, but I thought I'd clean things up while I'm at it.

I didn't find the reason why we did this in first place, maybe because the Xcode Clang at the time was too out of date to build LLVM? It doesn't seem to be a problem anymore though.

r? t-infra
2026-02-06 15:33:40 +01:00
Jonathan Brouwer
a9b4c7cfc9
Rollup merge of #152000 - lapla-cogito:ice_151027, r=BoxyUwU
Fix ICE in normalizing inherent associated consts with `#[type_const]`

Fixes rust-lang/rust#151027
Fixes rust-lang/rust#138089
Fixes rust-lang/rust#138226
Fixes rust-lang/rust#150960

When an inherent associated const is marked with `#[type_const]`, its generics expect args in the format `[Self, own_params...]`, similar to inherent associated types. However, HIR typeck's `instantiate_value_path` was constructing args in the regular associated const format `[impl_params..., own_params...]`. This mismatch caused ICEs when the `args` were later used in contexts expecting the IAC format, such as user type annotations and `borrowck`'s type ascription.
2026-02-06 15:33:40 +01:00
Jonathan Brouwer
f509250718
Rollup merge of #151945 - sorairolake:feature/nonzero-from-str-radix, r=Amanieu
feat: Add `NonZero::<T>::from_str_radix`

- Accepted ACP: rust-lang/libs-team#548
- Tracking issue: rust-lang/rust#152193

This pull request adds a method to `NonZero<T>` that parses a non-zero integer from a string slice with digits in a given base.

When using the combination of `int::from_str_radix` and `NonZero::<T>::new`, [`IntErrorKind::Zero`](https://doc.rust-lang.org/core/num/enum.IntErrorKind.html#variant.Zero) cannot be returned as an error. When using `NonZero::<T>::from_str`, `IntErrorKind::Zero` can be returned as an error, but this method cannot parse non-decimal integers.

`NonZero::<T>::from_str_radix` can return `IntErrorKind::Zero` as an error, and can parse both decimal integers and non-decimal integers.
2026-02-06 15:33:39 +01:00
Jonathan Brouwer
9f0eba2a06
Rollup merge of #151590 - folkertdev:cmse-unwrap-transparent, r=davidtwco
cmse: don't use `BackendRepr` when checking return type

tracking issue: https://github.com/rust-lang/rust/issues/81391
tracking issue: https://github.com/rust-lang/rust/issues/75835

r? davidtwco
cc @RalfJung

context: https://github.com/rust-lang/rfcs/pull/3884#discussion_r2715791429

I believe this is more reliable, and no longer relies on `BackendRepr`. I also added a test specifically for using `repr(Rust)`.
2026-02-06 15:33:38 +01:00
Takayuki Maeda
ee2c39a2b4 re-add TaKO8Ki to triagebot review queue 2026-02-06 22:24:36 +09:00
khyperia
54a9be469a mGCA: Support directly represented negated literals 2026-02-06 14:04:55 +01:00
Jonathan Brouwer
ea43035654
Convert to inline diagnostics in rustc_passes 2026-02-06 13:31:54 +01:00
bors
55bfca7d7d Auto merge of #152183 - alexcrichton:update-wasi-sdk, r=jieyouxu
Update wasi-sdk used in CI/releases

This is similar to prior updates such as rust-lang/rust#149037 in that this is just updating a URL. This update though has some technical updates accompanying it as well, however:

* The `wasm32-wasip2` target no longer uses APIs from WASIp1 on this target, even for startup. This means that the final binary no longer has an "adapter" which can help making instantiation of a component a bit more lean.

* In rust-lang/rust#147572 libstd was updated to use wasi-libc more often on the `wasm32-wasip2` target. This uncovered a number of bugs in wasi-libc such as rust-lang/rust#149864, rust-lang/rust#150291, and rust-lang/rust#151016. These are all fixed in wasi-sdk-30 so the workarounds in the standard library are all removed.

Overall this is not expected to have any sort of major impact on users of WASI targets. Instead it's expected to be a normal routine update to keep the wheels greased and oiled.
2026-02-06 12:21:48 +00:00
jyn
0436efe1b4 Get rid of paths function
Some history about `paths()`. The original intent Mark-Simulacrum had
when he introduced PathSet, to my knowledge, was that multiple paths
could be aliases for the same step. That's what rustdoc is doing; both
paths for rustdoc run exactly the same Step, regardless of whether one
or both are present.

That never really caught on. To my knowledge, rustdoc is the only usage
of paths() there's ever been.

Later, in 95503, I repurposed PathSet to mean "each crate in this set
should be passed to Step::make_run in RunConfig". That was not the
previous meaning.

Rustdoc never looks at run.paths in make_run, so it's safe to just treat
it as an alias, like elsewhere in bootstrap. Same for all the other tool
steps.

Co-authored-by: Tshepang Mbambo <hopsi@tuta.io>
2026-02-06 05:08:32 -05:00
bors
035b01b794 Auto merge of #152213 - JonathanBrouwer:rollup-trjCgZZ, r=JonathanBrouwer
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#152191 (Convert to inline diagnostics in `rustc_hir_analysis`)
 - rust-lang/rust#149329 (Mark match arms in try and for as being from desugarings.)
 - rust-lang/rust#151474 (Minor structural improvements)
 - rust-lang/rust#152107 (Convert to inline diagnostics in `rustc_borrowck`)
 - rust-lang/rust#152117 (Convert to inline diagnostics in `rustc_trait_selection`)
 - rust-lang/rust#152136 (Consolidate type const checks on `tcx.is_type_const`)
 - rust-lang/rust#152140 (Hard code the error code registry for custom drivers)
 - rust-lang/rust#152155 (Fix typos in riscv64a23-unknown-linux-gnu.md)
 - rust-lang/rust#152170 (Port `rustc_effective_visibility` to the new attribute parser)
 - rust-lang/rust#152182 (update compiler stable backport zulip msg)
 - rust-lang/rust#152184 (Port rustc_abi to the attribute parser)
 - rust-lang/rust#152195 (update openmp/offload builds to LLVM 22, Part 1)
 - rust-lang/rust#152202 (chore: clearify tidy's error message)

Failed merges:

 - rust-lang/rust#151744 (fix refining_impl_trait suggestion with return_type_notation)
 - rust-lang/rust#152212 (Port some attributes to the attr parser)
2026-02-06 09:12:28 +00:00
Jonathan Brouwer
2a01963b22
Rollup merge of #152202 - nyurik:better-msg, r=jieyouxu
chore: clearify tidy's error message

it took me a while to realize this error was due to the name of the file, not the file's content
2026-02-06 10:06:48 +01:00
Jonathan Brouwer
8420a080da
Rollup merge of #152195 - ZuseZ4:update-offload-llvm22-A, r=jieyouxu
update openmp/offload builds to LLVM 22, Part 1

This part of the update of OpenMP/Offload to LLVM 22 does not depend on a backport in the future LLVM release candidate 3. Let's therefore merge it first, to unblock existing users/developers.

r? @jieyouxu
2026-02-06 10:06:48 +01:00
Jonathan Brouwer
0cc62c81e5
Rollup merge of #152184 - Ozzy1423:attrs3, r=jdonszelmann
Port rustc_abi to the attribute parser

Tracking issue: https://github.com/rust-lang/rust/issues/131229

This attribute either dumps the abi info for functions (debug arg)
or if you put it on a pair of fn ptr's it checks they match (assert_eq arg)

r? @JonathanBrouwer
2026-02-06 10:06:47 +01:00
Jonathan Brouwer
6db1e097f6
Rollup merge of #152182 - apiraino:update-compiler-stable-backport-zulip-msg, r=jieyouxu
update compiler stable backport zulip msg

I'd like to update the message when stable backports (for t-compiler) Zulip topics are opened.

Stable backports mention the channel i.e. also people who might not have context, example:
[#t-compiler/backports > #150590: stable-nominated @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports/topic/.23150590.3A.20stable-nominated/near/569989784)

Beta backports mention author+reviewer (which fits better), example:
[#t-compiler/backports > #151896: beta-nominated @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/474880-t-compiler.2Fbackports/topic/.23151896.3A.20beta-nominated/near/571171604)

This patch makes the `stable` backport opening message just like the `beta` backport one.

Thanks
2026-02-06 10:06:47 +01:00
Jonathan Brouwer
19f4c05129
Rollup merge of #152170 - jdonszelmann:port-rustc-effective-visibility, r=JonathanBrouwer
Port `rustc_effective_visibility` to the new attribute parser

r? @JonathanBrouwer
2026-02-06 10:06:46 +01:00
Jonathan Brouwer
19840e1bb7
Rollup merge of #152155 - wolfv:patch-1, r=wesleywiser
Fix typos in riscv64a23-unknown-linux-gnu.md
2026-02-06 10:06:45 +01:00
Jonathan Brouwer
d96d73fd86
Rollup merge of #152140 - bjorn3:driver_fixed_error_codes, r=jdonszelmann
Hard code the error code registry for custom drivers

And do some cleanups enabled by this.
2026-02-06 10:06:45 +01:00
Jonathan Brouwer
ce706cd4ef
Rollup merge of #152136 - eggyal:consolidate-type-const-checks, r=BoxyUwU
Consolidate type const checks on `tcx.is_type_const`

A little bit of cleanup; explanation can be found in the reporting issue.

Fixes rust-lang/rust#152124
r? BoxyUwU
2026-02-06 10:06:44 +01:00
Jonathan Brouwer
771fa578bf
Rollup merge of #152117 - JonathanBrouwer:convert_trait_selection2, r=GuillaumeGomez
Convert to inline diagnostics in `rustc_trait_selection`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 10:06:43 +01:00
Jonathan Brouwer
65a1d9708d
Rollup merge of #152107 - JonathanBrouwer:convert_borrowck, r=lqd
Convert to inline diagnostics in `rustc_borrowck`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 10:06:43 +01:00
Jonathan Brouwer
3fb526578e
Rollup merge of #151474 - nnethercote:circ-deps, r=davidtwco
Minor structural improvements

Some small cleanups.

r? @davidtwco
2026-02-06 10:06:42 +01:00
Jonathan Brouwer
ee753e8113
Rollup merge of #149329 - Jarcho:for_question_ctxt, r=davidtwco
Mark match arms in try and for as being from desugarings.

Some of the arms created by these desugarings have an expression which isn't marked as coming from the desugaring. e.g. try generates `Continue(val) => val` where the expression has the span of the original parameter (done for diagnostic purposes). Since the arm created just used that span they end up without a desugaring mark unnecessarily.

This is only a minor annoyance with some work I'm doing in clippy.
2026-02-06 10:06:41 +01:00
Jonathan Brouwer
de0e4bd0cc
Rollup merge of #152191 - JonathanBrouwer:convert_hir_analysis, r=jdonszelmann
Convert to inline diagnostics in `rustc_hir_analysis`

For https://github.com/rust-lang/rust/issues/151366
r? @jdonszelmann
2026-02-06 10:06:41 +01:00
Jonathan Brouwer
57aae94bed
Convert to inline diagnostics in rustc_hir_analysis 2026-02-06 10:05:35 +01:00
Shun Sakai
d0aa337146 feat: Add NonZero::<T>::from_str_radix 2026-02-06 16:15:00 +09:00
bors
cf16cd9b75 Auto merge of #152086 - nnethercote:stable-hashing-cleanups, r=cjgillot
Stable hashing cleanups

I took a close look at `rustc_query_system::ich` and found a bunch of things to improve.

r? @cjgillot
2026-02-06 06:02:23 +00:00
lapla
22885d2526
Reorganize tests that no longer crash 2026-02-06 14:44:04 +09:00
lapla
d5957f582b
Add test for inherent type_const normalization 2026-02-06 14:44:03 +09:00
lapla
c450ecf31b
Transform args for inherent type_consts in instantiate_value_path 2026-02-06 14:44:02 +09:00
lapla
43947428ff
Extend check_args_compatible to handle IACs 2026-02-06 14:44:00 +09:00