Commit graph

317603 commits

Author SHA1 Message Date
Jonathan Brouwer
fced23053c
Rollup merge of #152289 - Urgau:expect-in-derive-150553, r=jdonszelmann
Also duplicate `#[expect]` attribute in `#[derive]`-ed code

This PR updates our derive logic to also duplicate any `#[expect]` attribute in the `#[derive]`-ed code, as we already do for all the other lint attribute (`#[allow]`, `#[warn]`, `#[deny]`, ...).

The original and duplicated attribute share the same attribute id, which due to the way [`check_expectations`](56aaf58ec0/compiler/rustc_lint/src/expect.rs (L28-L46)) is implemented makes the expectation fulfilled if the lint is either trigger in the original code or the derived code.

This was discussed by T-lang in https://github.com/rust-lang/rust/issues/150553#issuecomment-3780810363.

cc @rust-lang/lang-ops (in case you want to do an FCP)
Fixes rust-lang/rust#150553
2026-02-07 16:04:41 +01:00
Jonathan Brouwer
6e7f929f7c
Rollup merge of #152168 - jdonszelmann:port-rustc-intrinsic-const-stable-indirect, r=jonathanbrouwer
Port `rustc_intrinsic_const_stable_indirect` and `rustc_intrinsic` to the new attribute parser

r? @JonathanBrouwer
2026-02-07 16:04:41 +01:00
Jonathan Brouwer
972a53167c
Rollup merge of #149960 - folkertdev:cfg-select-unreachable-lint, r=JonathanBrouwer
add `unreachable_cfg_select_predicates` lint

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

Split out from https://github.com/rust-lang/rust/pull/149783. This lint is emitted on branches of a `cfg_select!` that are statically known to be unreachable. The lint is only emitted when the feature is enabled, so this change specifically does not need an FCP, and the lint will be stabilized alongside the feature (see https://github.com/rust-lang/rust/pull/149783#issuecomment-3648000286).
2026-02-07 16:04:40 +01:00
Urgau
2407f47903 Also duplicate #[expect] attribute in #[derive]-ed code 2026-02-07 14:29:40 +01:00
Jana Dönszelmann
c42a581d2f
Port rustc_intrinsic_const_stable_indirect to the new attribute parser 2026-02-07 14:12:56 +01:00
Jana Dönszelmann
9249e9f78a
Port rustc_intrinsic to the new attribute parser 2026-02-07 14:12:56 +01:00
Folkert de Vries
bad1a450c0
use test instead of unix to be platform-independent 2026-02-07 13:33:25 +01:00
bors
06cafcbe08 Auto merge of #152274 - JonathanBrouwer:rollup-5GoDGKf, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#146900 (Add avr_target_feature)
 - rust-lang/rust#150949 (Port symbol mangler attrs)
 - rust-lang/rust#152252 (Convert diagnostic style checks)
 - rust-lang/rust#152265 (Use `.map.collect` to aggregate in `.to_ty` of tuples)
2026-02-07 08:55:53 +00:00
Jonathan Brouwer
5e476baeab
Rollup merge of #152265 - lapla-cogito:tytuple_agg, r=Zalathar
Use `.map.collect` to aggregate in `.to_ty` of tuples

Since rust-lang/rust#48994 might have been resolved, we can address the FIXME.
2026-02-07 09:41:08 +01:00
Jonathan Brouwer
723eb92a31
Rollup merge of #152252 - JonathanBrouwer:port-tidy-checks, r=jdonszelmann
Convert diagnostic style checks

For https://github.com/rust-lang/rust/issues/151366

r? @jdonszelmann
2026-02-07 09:41:07 +01:00
Jonathan Brouwer
defc1d7a95
Rollup merge of #150949 - Bryntet:port_symbol_mangler_attrs, r=jdonszelmann,JonathanBrouwer
Port symbol mangler attrs

Tracking issue: rust-lang/rust#131229

@JonathanBrouwer could you run perf on this?
2026-02-07 09:41:07 +01:00
Jonathan Brouwer
d7c812cb57
Rollup merge of #146900 - taiki-e:avr-target-feature, r=workingjubilee
Add avr_target_feature

This adds the following unstable target features (tracking issue: https://github.com/rust-lang/rust/issues/146889):

- The following two are particularly important for properly supporting inline assembly:
  - `tinyencoding`: AVR has devices that reduce the number of registers, similar to RISC-V's RV32E. This feature is necessary to support inline assembly in such devices. (see also https://github.com/rust-lang/rust/pull/146901)
  - `lowbytefirst`: AVR's memory access is per 8-bit, and when writing 16-bit ports, the bytes must be written in a specific order. This order depends on devices, making this feature necessary to write proper inline assembly for such use cases. (see also 2a528760bf)
- The followings help recognizing whether specific instructions are available:
  - `addsubiw`
  - `break`
  - `eijmpcall`
  - `elpm`
  - `elpmx`
  - `ijmpcall`
  - `jmpcall`
  - `lpm`
  - `lpmx`
  - `movw`
  - `mul`
  - `rmw`
  - `spm`
  - `spmx`

  Of these, all except `addsubiw`, `break`, `ijmpcall`, `lpm`, `rmw`, `spm`, and `spmx` have [corresponding conditional codes in avr-libc](https://github.com/search?q=repo%3Aavrdudes%2Favr-libc+%2F__AVR_HAVE_%2F&type=code&p=1). LLVM also has `des` feature, but I excluded it from this PR because [DES](https://en.wikipedia.org/wiki/Data_Encryption_Standard) is insecure.

- Report future-incompatible warning (https://github.com/rust-lang/rust/issues/116344) for -C target-feature=-sram and -C target-cpu=<device_without_sram> cases because SRAM is minimum requirement for non-assembly language in both avr-gcc and LLVM.
  - See https://github.com/rust-lang/rust/pull/146900#issuecomment-3323558005 for details.

LLVM also has `smallstack`, `wrappingrjmp`, and `memmappedregs` features, but I skipped them because they didn't seem to belong to either of the above categories, but I might have missed something.

(The feature names are match with [definitions in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-21.1.0/llvm/lib/Target/AVR/AVRDevices.td).)

cc @Patryk27 @Rahix
r? workingjubilee

@rustbot label +O-AVR +A-target-feature
2026-02-07 09:41:06 +01:00
Jonathan Brouwer
c1091da34c
Fix existing messages in stderrs 2026-02-07 09:13:42 +01:00
Jonathan Brouwer
edd43c9e1f
Fix existing messages in the diag structs 2026-02-07 09:11:34 +01:00
Jonathan Brouwer
ca9c227700
Check style of messages in rustc_macros 2026-02-07 09:09:23 +01:00
Jonathan Brouwer
f71347c611
Remove tidy fluent file checks 2026-02-07 09:09:21 +01:00
lapla
b5cd820ef4
Use .map.collect to aggregate in .to_ty of tuples 2026-02-07 16:49:06 +09: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
Folkert de Vries
a6bd7cc54e
make the lint more sophisticated 2026-02-07 02:19:43 +01:00
Folkert de Vries
8aea4b1775
add unreachable_cfg_select_predicates lint
This is emitted on branches of a `cfg_select!` that are statically known
to be unreachable.
2026-02-07 02:19:42 +01:00
Edvin Bryntesson
10f0c2d579
Port #[rustc_symbol_name] and #[rustc_def_path] to attr parser 2026-02-07 01:43:00 +01: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