Commit graph

22237 commits

Author SHA1 Message Date
Ben Kimock
6feceec6b3 Disable SimplifyComparisonIntegral 2026-01-17 15:39:57 -05:00
León Orell Valerian Liehr
36e6625457
[beta] rustdoc: Stop unconditionally evaluating the initializer of associated consts 2026-01-17 12:25:36 +01:00
Urgau
249d399caa Don't lint on interior mutable const item coming from derefs
(cherry picked from commit 2581c2571c)
2026-01-08 16:09:05 -08:00
Urgau
0aa11b5dd2 Add regression test for const_item_interior_mutations deref FP
(cherry picked from commit 0bc29cec45)
2026-01-08 16:09:05 -08:00
Jakub Beránek
9f8bfd6b4a Revert "Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer"
This reverts commit 82a17b30d8, reversing
changes made to 5019bdaefe.

(cherry picked from commit 74387157c7)
2026-01-08 16:08:18 -08:00
Kivooeo
3f4f07f0b9 add check for uninhabited types along side never
(cherry picked from commit 2a2da782d3)
2025-12-20 13:54:03 -08:00
Matthias Krüger
8e46521d0e
Rollup merge of #149666 - Zalathar:backend-has-zstd, r=jieyouxu
Add perma-unstable `--print=backend-has-zstd` for use by compiletest

Tests for `-Zdebuginfo-compression=zstd` need to be skipped if LLVM was built without support for zstd compression.

Currently, compiletest relies on messy and fragile heuristics to detect whether the compiler's LLVM was built with zstd support. But the compiler itself already knows whether LLVM has zstd or not, so it's easier for compiletest to just ask the compiler.

---

Originally I was intending for this to be a `--print=debuginfo-compression` flag that would print out a list of values supported by `-Zdebuginfo-compression=`. I got that working locally, but it was more complex than I was happy with (in both rustc and compiletest), so I decided to cut scope and instead add a very narrow perma-unstable print request instead.

There is always a circularity hazard whenever we ask the compiler-under-test for information about how to test it. But in this case, the underlying compiler code is fairly simple, whereas the previous heuristics were inherently messy and unreliable anyway.
2025-12-05 16:17:12 +01:00
Matthias Krüger
d076da7e89
Rollup merge of #149647 - reddevilmidzy:test, r=Kivooeo
Add regression test for 141845

close: rust-lang/rust#141845

I saw the `tests/ui/associated-inherent-types` directory, but I felt the current location was a better fit.
2025-12-05 16:17:11 +01:00
Matthias Krüger
0c05bb5606
Rollup merge of #149630 - wafarm:fix-149604, r=JonathanBrouwer
Check identifiers defined in macros when suggesting identifiers hidden by hygiene

Fix rust-lang/rust#149604

r? `@JonathanBrouwer` (Since you reviewed the other one related to this)
2025-12-05 16:17:10 +01:00
Matthias Krüger
c42ce16c7b
Rollup merge of #149548 - aerooneqq:ice-issue-144594, r=petrochenkov
Generate delegation error body when delegation is not resolved

This PR relates to the delegation feature rust-lang/rust#118212, it fixes rust-lang/rust#144594 ICE.
r? `@petrochenkov`
2025-12-05 16:17:10 +01:00
Matthias Krüger
c7889581ca
Rollup merge of #149547 - tgross35:range-iterators, r=joboet
library: Rename `IterRange*` to `Range*Iter`

There is a weak convention in the ecosystem that `IterFoos` is an iterator yielding items of type `Foo` (e.g. `bitflags` `IterNames`, `hashbrown` `IterBuckets`), while `FooIter` is an iterator over `Foo` from an `.iter()` or `.into_iter()` method (e.g. `memchr` `OneIter`, `regex` `SetMatchesIter`). Rename `IterRange`, `IterRangeInclusive`, and `IterRangeFrom` to `RangeIter`, `RangeInclusiveIter`, and `RangeInclusiveIter` to match this.

Tracking issue: https://github.com/rust-lang/rust/issues/125687 (`new_range_api`)
2025-12-05 16:17:09 +01:00
Matthias Krüger
7850fc4b13
Rollup merge of #149101 - reddevilmidzy:mutable, r=eholk
Improve mutable-binding suggestion to include name

resolve: rust-lang/rust#148467
2025-12-05 16:17:07 +01:00
aerooneqq
3e717121a1 Generate error delegation body when delegation is not resolved 2025-12-05 15:22:26 +03:00
bors
97b131c900 Auto merge of #148602 - BoxyUwU:coercion_cleanup_uncontroversial, r=lcnr
misc coercion cleanups and handle safety correctly

r? lcnr

### "remove normalize call"

Fixes rust-lang/rust#132765

If the normalization fails we would sometimes get a `TypeError` containing inference variables created inside of the probe used by coercion. These would then get leaked out causing ICEs in diagnostics logic

### "leak check and lub for closure<->closure coerce-lubs of same defids"

Fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/233
```rust
fn peculiar() -> impl Fn(u8) -> u8 {
    return |x| x + 1
}
```
the `|x| x + 1` expr has a type of `Closure(?31t)` which we wind up inferring the RPIT to. The `CoerceMany` `ret_coercion` for the whole `peculiar` typeck has an expected type of `RPIT` (unnormalized). When we type check the `return |x| x + 1` expr we go from the never type to `Closure(?31t)` which then participates in the `ret_coercion` giving us a `coerce-lub(RPIT, Closure(?31t))`.

Normalizing `RPIT` gives us some `Closure(?50t)` where `?31t` and `?50t` have been unified with `?31t` as the root var. `resolve_vars_if_possible` doesn't resolve infer vars to their roots so these wind up with different structural identities so the fast path doesn't apply and we fall back to coercing to a `fn` ptr. cc rust-lang/rust#147193 which also fixes this

New solver probably just gets more inference variables here because canonicalization + generally different approach to normalization of opaques. Idk :3

### FCP worthy stuffy

there are some other FCP worthy things but they're in my FCP comment which also contains some analysis of the breaking nature of the previously listed changes in this PR: https://github.com/rust-lang/rust/pull/148602#issuecomment-3503497467
2025-12-05 11:46:41 +00:00
Zalathar
84ff44c749 Add perma-unstable --print=backend-has-zstd for use by compiletest
Tests for `-Zdebuginfo-compression=zstd` need to be skipped if LLVM was built
without support for zstd compression.

Currently, compiletest relies on messy and fragile heuristics to detect whether
the compiler's LLVM was built with zstd support. But the compiler itself
already knows whether LLVM has zstd or not, so it's easier for compiletest to
just ask the compiler.
2025-12-05 14:27:52 +11:00
bors
3e2dbcdd3a Auto merge of #149646 - matthiaskrgr:rollup-jbfeow8, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#147224 (Emscripten: Turn wasm-eh on by default)
 - rust-lang/rust#149405 (Recover on misspelled item keyword)
 - rust-lang/rust#149443 (Tidying up UI tests [6/N])
 - rust-lang/rust#149524 (Move attribute safety checking to attribute parsing)
 - rust-lang/rust#149593 (powf, powi: point out SNaN non-determinism)
 - rust-lang/rust#149605 (Use branch name instead of HEAD when unshallowing)
 - rust-lang/rust#149612 (Apply the `bors` environment also to the `outcome` job)
 - rust-lang/rust#149623 (Don't require a normal tool build of clippy/rustfmt when running their test steps)
 - rust-lang/rust#149627 (Point to the item that is incorrectly annotated with `#[diagnostic::on_const]`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-04 22:04:03 +00:00
reddevilmidzy
3d0f5f2f88 Add regression test for 141845 2025-12-05 00:39:55 +09:00
Matthias Krüger
69f8a5ca67
Rollup merge of #149627 - lapla-cogito:diag_onconst, r=jdonszelmann
Point to the item that is incorrectly annotated with `#[diagnostic::on_const]`

close rust-lang/rust#149606

r? estebank
2025-12-04 16:07:57 +01:00
Matthias Krüger
0c95abb979
Rollup merge of #149524 - JonathanBrouwer:move_attr_safety, r=jdonszelmann
Move attribute safety checking to attribute parsing

This PR moves attribute safety checking to be done during attribute parsing. The `cfg` and `cfg_attr` attribute no longer need special-cased safety checking, yay!

This PR is a part 1 of 2, in the second part I'd like to define attribute safety in the attribute parsers rather than getting the information from BUILTIN_ATTRIBUTE_MAP, but to keep PRs reviewable lets do that separately.

Fixes https://github.com/rust-lang/rust/issues/148453 by reordering the diagnostics. The "cannot find attribute" diagnostic now appears first, but both diagnostics still appear.

r? `@jdonszelmann`
2025-12-04 16:07:53 +01:00
Matthias Krüger
fa79ba65c5
Rollup merge of #149443 - reddevilmidzy:t6, r=Kivooeo
Tidying up UI tests [6/N]

> [!NOTE]
> Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge.

part of rust-lang/rust#133895

removed directory  `tests/ui/trait-objects`,  `tests/ui/for`, `tests/ui/warnings`

`trait-objects` -> `traits/object`
`for` -> `for-loop-while` (except `for/issue-20605.rs` test. this relocated to `traits/dyn-iterator-deref-in-for-loop.rs`)
`warnings` -> `resolve`, `entry-point`

r? Kivooeo
2025-12-04 16:07:53 +01:00
Matthias Krüger
55fa9f74db
Rollup merge of #149405 - scrabsha:push-tzonpluy, r=jdonszelmann
Recover on misspelled item keyword

the title says everything. first commit adds a test that shows how current `main` behaves on misspelled item keyword. second commit adds the recovery, which allows to emit many more errors.
2025-12-04 16:07:52 +01:00
Matthias Krüger
c80ac0f21a
Rollup merge of #147224 - hoodmane:wasm-eh-default-on, r=bjorn3
Emscripten: Turn wasm-eh on by default

As specified by [MCP](https://github.com/rust-lang/compiler-team/issues/920)
Resolves https://github.com/rust-lang/rust/issues/148309
Resolves https://github.com/rust-lang/rust/issues/112195
2025-12-04 16:07:51 +01:00
bors
29e035e172 Auto merge of #149632 - matthiaskrgr:rollup-c5iqgtn, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#149521 (Improve `io::Error::downcast`)
 - rust-lang/rust#149544 (Only apply `no_mangle_const_items`'s suggestion to plain const items)
 - rust-lang/rust#149545 (fix the check for which expressions read never type)
 - rust-lang/rust#149570 (rename cortex-ar references to unified aarch32)
 - rust-lang/rust#149574 (Batched compiletest Config fixups)
 - rust-lang/rust#149579 (Motor OS: fix compile error)
 - rust-lang/rust#149595 (Tidying up `tests/ui/issues` tests [2/N])
 - rust-lang/rust#149597 (Revert "implement and test `Iterator::{exactly_one, collect_array}`")
 - rust-lang/rust#149608 (Allow PowerPC spe_acc as clobber-only register)
 - rust-lang/rust#149610 (Implement benchmarks for uN::{gather,scatter}_bits)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-12-04 14:38:19 +00:00
Matthias Krüger
5c4915734d
Rollup merge of #149608 - pmur:murp/ppc-clobber-speacc, r=Amanieu
Allow PowerPC spe_acc as clobber-only register

This register is only supported on the *powerpc*spe targets. It is only recognized by LLVM. gcc does not accept this as a clobber, nor does it support these targets.

This is a volatile register, thus it is included with clobber_abi.

r? `@Amanieu`
r? `@antoyo`
2025-12-04 09:22:15 +01:00
Matthias Krüger
c598b4e300
Rollup merge of #149597 - jdonszelmann:revert-iterator-exactly-one, r=wafflelapkin
Revert "implement and test `Iterator::{exactly_one, collect_array}`"

This reverts https://github.com/rust-lang/rust/pull/149270

I was quite excited it merged, and immediately realized with ``@WaffleLapkin`` that this is a breaking change on nightly! Despite still being marked as unstable, the name conflicts with the name on itertools as was discussed on the PR itself: https://github.com/rust-lang/rust/pull/149270#issuecomment-3573812447.

I'll reopen the PR though, and mark it as blocked on https://github.com/rust-lang/rust/pull/148605
2025-12-04 09:22:14 +01:00
Matthias Krüger
6e8e08cc32
Rollup merge of #149595 - reddevilmidzy:t9, r=Kivooeo
Tidying up `tests/ui/issues` tests [2/N]

> [!NOTE]
> Intermediate commits are intended to help review, but will be squashed add comment commit prior to merge.

part of rust-lang/rust#133895
2025-12-04 09:22:14 +01:00
Matthias Krüger
a411fe8f8d
Rollup merge of #149545 - WaffleLapkin:type_ascribe2, r=jackh726
fix the check for which expressions read never type

Fixes rust-lang/rust#149542
Fixes rust-lang/rust#149431

First commit is a drive-by needed for the refactor of the unreachable code lint, see https://github.com/rust-lang/rust/issues/148303
2025-12-04 09:22:11 +01:00
Matthias Krüger
5c9a4eed87
Rollup merge of #149544 - reddevilmidzy:where, r=fmease
Only apply `no_mangle_const_items`'s suggestion to plain const items

resolve: rust-lang/rust#149511
2025-12-04 09:22:11 +01:00
Matthias Krüger
05b2958024
Rollup merge of #149549 - Jamesbarford:chore/regression-test-ttbr0_el2, r=WaffleLapkin
Regression test for system register `ttbr0_el2`

Regression test for recognising the `ttbr0_el2` register.

closes rust-lang/rust#97724
2025-12-04 08:46:22 +01:00
Matthias Krüger
420ef95cd7
Rollup merge of #149528 - fee1-dead-contrib:rangeboundreword, r=jieyouxu
reword error for invalid range patterns

For half-open ranges, specifies that the upper bound cannot be the minimum.

Also specify that this only applies to range patterns and not also expressions.

Fixes rust-lang/rust#149165
2025-12-04 08:46:21 +01:00
Matthias Krüger
40c97a9279
Rollup merge of #149501 - lcnr:no-hard-error-on-norm-failure, r=lqd,oli-obk
CTFE: avoid emitting a hard error on generic normalization failures

Fixes rust-lang/rust#149081.

The fix is quite unsatisfying and should not be necessary, cc rust-lang/rust#149283. That change is significantly more involved. This temporary fix introduces some unnecessary complexity and may hide other type system bugs.

cc ````@rust-lang/types```` I think we should try to fix issue rust-lang/rust#149283 in the near future and then remove this hack again.

I originally intended a more targeted fix. I wanted to skip evaluating constants in MIR opts if their body was polymorphic and the current generic arguments still reference generic parameters. Notes from looking into this:
- we only fetch the MIR in the `eval_to_allocation_raw` query
- figuring out which MIR to use is hard
	- dealing with trivial consts is annoying
	- need to resolve instances for associated consts
	- implementing this by hand is hard
- inlining handles this issue by bailing on literally all normalization failures, even the ones that imply an unsoundness
	- `try_normalize_after_erasing_regions` generally does two things
		- deal with ambiguity after inlining
		- deal with error tainting issues (please don't, we should stop doing that)
- CTFE could be changed to always silently ignore normalization failures if we're in a generic body
	- hides actual bugs <- went with this option

r? types
2025-12-04 08:46:20 +01:00
Matthias Krüger
82a17b30d8
Rollup merge of #149147 - chenyukang:yukang-fix-unused_assignments-macro-gen-147648, r=JonathanBrouwer
Fix unused_assignments false positives from macros

Fixes rust-lang/rust#147648
2025-12-04 08:46:18 +01:00
Matthias Krüger
5019bdaefe
Rollup merge of #147841 - jdonszelmann:test-macro-ice, r=wafflelapkin
Fix ICE when applying test macro to crate root

This PR does a couple of things. First of all, I found [an ICE](https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=a733a7f3d223e1a9712e44b571f3e5cf) that happens when applying `#![core::prelude::v1::test]` to the crate root. This is caused by the test macro not expanding to an item when `--test` isn't applied. For the crate root, that means it deletes the crate....

The fix now first does target checking, and only if the target is valid discards the item when `--test` isn't applied. The discarding is, I think, important for perf.

The problem with this PR is that it means that `#[test]` applied to structs previously would give no errors unless `--test` is applied! That sounds like a bug to me, but maybe we should crater run it just in case, since technically that's a breaking change. Errors in such items wouldn't be reported previously.

 Also fixed a smol diagnostics bug with `#[bench]`'s error messages refering to `#[test]` accidentally.

r? noratrieb (since I already explained you a bunch, feel free to re-assign)

Fixes https://github.com/rust-lang/rust/issues/114920
2025-12-04 08:46:17 +01:00
Wafarm
e513ce3fb4
Check identifiers defined in macros when suggesting identifiers hidden by hygiene 2025-12-04 14:58:46 +08:00
reddevilmidzy
d49075f083 Suppress ref mut suggestion for for-loop bindings 2025-12-04 15:13:40 +09:00
reddevilmidzy
f30eced2e3 Wrap binding name in parentheses in for-loop mut suggestion 2025-12-04 15:07:33 +09:00
lapla
2db3c95f72
Point to the item that is incorrectly annotated with #[diagnostic::on_const] 2025-12-04 11:59:19 +09:00
reddevilmidzy
2951d72219 Simplify and robustly compute suggestion span using
`vis_span.to(ident.span.shrink_to_lo())`
2025-12-04 11:01:40 +09:00
reddevilmidzy
6ce0f0ff91 Only apply no_mangle_const_items's suggestion to plain const items 2025-12-04 11:01:10 +09:00
Hood Chatham
f07a84fde8
Emscripten: Turn wasm-eh on by default
As specified by MCP:
https://github.com/rust-lang/compiler-team/issues/920
Resolves https://github.com/rust-lang/rust/issues/148309
2025-12-03 14:34:07 -08:00
Paul Murphy
b54b288518 Allow PowerPC spe_acc as clobber-only register
This register is only supported on the *powerpc*spe targets. It is
only recognized by LLVM. gcc does not accept this as a clobber, nor
does it support these targets.

This is a volatile register, thus it is included with clobber_abi.
2025-12-03 12:37:22 -06:00
Sasha Pourcelot
9ffde14aa4 Recover on misspelled item keyword 2025-12-03 18:09:40 +00:00
Sasha Pourcelot
f9b30df1b0 Add test tracking recovery for misspelled item keyword 2025-12-03 17:18:22 +00:00
Boxy Uwu
2f95ecfdd6 reviews 2025-12-03 16:36:32 +00:00
Jana Dönszelmann
8f8247812e
address review comments 2025-12-03 17:01:49 +01:00
Jonathan Brouwer
1d204fcf1d
Add unsafe to no_mangle incremental tests 2025-12-03 17:00:22 +01:00
Jonathan Brouwer
892bd18ad8
Add a regression test for unsafe nonexistent attributes 2025-12-03 17:00:08 +01:00
Jonathan Brouwer
6e3a015400
UI test changes 2025-12-03 17:00:08 +01:00
Jana Dönszelmann
97d4d2154f
fixup name in diagnostics 2025-12-03 16:38:24 +01:00
Jana Dönszelmann
9dd3caeebe
only discard items with #[test] on it when target is valid 2025-12-03 16:38:24 +01:00