Commit Graph

24117 Commits

Author SHA1 Message Date
Jonathan Brouwer 2d9fde77a8 Rollup merge of #153594 - reddevilmidzy:ui-refactor, r=JohnTitor,Kivooeo
Move some ui tests

> [!NOTE]
> I split the commits to make the review easier and to keep the git history easier to trace.

Renamed issue-xxx tests

`tests/ui/dyn-drop` -> `tests/ui/dyn-keyword`
`tests/ui/missing-trait-bounds` -> `tests/ui/trait-bound/missing-trait-bounds`
`tests/ui/recursion_limit` -> `tests/ui/recursion/recursion_limit`
`tests/ui/version` -> `tests/ui/compile-flags`

Reorganize `tests/ui/empty`
2026-03-09 11:49:26 +01:00
Jonathan Brouwer d4630f14eb Rollup merge of #153509 - GuillaumeGomez:migrate-diag2, r=JonathanBrouwer
Cleanup unused diagnostic emission methods - part 2

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

r? @JonathanBrouwer
2026-03-09 11:49:25 +01:00
Jonathan Brouwer 662798eb63 Rollup merge of #153305 - TimNN:bundle-assert, r=Mark-Simulacrum
Adapt codegen test to accept operand bundles

The updated test current fails when rustc is built with HEAD LLVM: https://buildkite.com/llvm-project/rust-llvm-integrate-prototype/builds/44013/steps/canvas?sid=019cafec-3cca-44b2-aa9f-b41c0a940e8b

Likely as a result of https://github.com/llvm/llvm-project/pull/169923

Since the new codegen merges two lines into one, I couldn't figure out a way to make the test work on both LLVM versions without introducing revisions. (Though I could instead make the test run on only LLVM 23+).

@rustbot label llvm-main
2026-03-09 11:49:24 +01:00
Jonathan Brouwer fad370cc4a Rollup merge of #152800 - spirali:fix-FindParamInClause, r=lcnr
Adds recursion limit into FindParamInClause

Fixes rust-lang/rust#152716

r? lcnr
2026-03-09 11:49:23 +01:00
Jonathan Brouwer 9c09ff3dcd Rollup merge of #139692 - spastorino:do-not-rustfmt-ignore, r=Mark-Simulacrum
Rustfmt now support use closures

This should be merged when https://github.com/rust-lang/rustfmt/pull/6532 is used by CI's rustfmt.
2026-03-09 11:49:23 +01:00
Jonathan Brouwer 2f5d672f46 Rollup merge of #153290 - Gelbpunkt:iter-repeat-n-trivial-drop-lower-bound-hermit, r=Mark-Simulacrum
tests: codegen-llvm: iter-repeat-n-trivial-drop: Allow non-zero lower bound to __rust_alloc size

LLVM emits a lower bound of 8 for the size parameter to `__rust_alloc` when targeting `x86_64-unknown-hermit`. Since that is also completely valid, relax the lower bound check.

I'm not really sure why LLVM is able to infer this - with the same setup targeting `x86_64-unknown-linux-gnu` I also see the lower bound of 0. Not that it's wrong, but I'd be curious to know which codegen options play into this.
2026-03-09 11:49:22 +01:00
Jonathan Brouwer a5bd6be835 Rollup merge of #152847 - Jamesbarford:chore/get_unchecked-inline-test, r=Mark-Simulacrum
Test for armv7 `get_unchecked(...)` inlining

Added test for `get_unchecked(...)` to be inlined on armv7.

closes https://github.com/rust-lang/rust/issues/131745
2026-03-09 11:49:21 +01:00
Guillaume Gomez 4e2a519d12 Remove TyCtxt::node_span_lint usage from rustc_trait_selection 2026-03-09 11:35:33 +01:00
Guillaume Gomez 0d974a2cc0 Remove TyCtxt::node_span_lint usage from rustc_mir_build 2026-03-09 11:35:33 +01:00
James Barford-Evans 00980f438e Test for armv7 get_unchecked(...) inlining 2026-03-09 09:18:23 +00:00
Redddy e63664773c Move some ui tests
* Move dyn-drop to dyn-keyword
* Reorganize `tests/ui/empty` into specific dirs

remove tests/ui/empty/empty-linkname.rs duplicate of tests/ui/error-codes/E0454.rs
* Move `missing-trait-bounds` to `trait-bound/missing-trait-bounds`
* bless traits/missing-trait-bounds tests
* Move `recursion_limit` to `recursion/recursion_limit`
* Move `version` to `compile-flags`
2026-03-09 09:11:06 +00:00
Jonathan Brouwer 83e6dbf9e1 Rollup merge of #151900 - tgross35:num-internal-imp, r=Mark-Simulacrum
num: Separate public API from internal implementations

Currently we have a single `core::num` module that contains both thin wrapper API and higher-complexity numeric routines. Restructure this by moving implementation details to a new `imp` module.

This results in a more clean separation of what is actually user-facing compared to items that have a stability attribute because they are public for testing.

The first commit does the actual change then the second moves a portion back.
2026-03-08 22:51:52 +01:00
Santiago Pastorino 85c4af74fa Rustfmt now support use closures on edition 2018 2026-03-08 10:22:26 -03:00
Stuart Cook 9886a13ab0 Rollup merge of #153548 - cyrgani:closuretest, r=JohnTitor
add test for closure precedence in `TokenStream`s

A test for a regression found by the https://github.com/rust-lang/rust/pull/151830 crater run in several different crates.
2026-03-08 14:01:36 +11:00
Stuart Cook 4400f2f835 Rollup merge of #153202 - dpaoliello:arm64unwind, r=cuviper
[win] Fix truncated unwinds for Arm64 Windows

Panic backtraces on ARM64 Windows are truncated because Rust's LLVM configuration sets `NoTrapAfterNoreturn = true`, which suppresses the generation of `brk #0x1` (trap) instructions after calls to `noreturn` functions. Without this trap instruction, the return address from a `noreturn` call points past the end of the calling function into an unrelated function, causing `RtlLookupFunctionEntry` to return the wrong unwind information, which terminates the stack walk prematurely.

In general, `NoTrapAfterNoreturn = true` is recommended against for Windows, since we have seen security vulnerabilities in the past where an attacker has managed to return from a noreturn function, or the function wasn't actually noereturn, resulting in executing whatever was after the call.

This change disables setting `NoTrapAfterNoreturn = true` for Windows.

Fixes rust-lang/rust#140489
2026-03-08 14:01:34 +11:00
Ada Bohm 592246e2a1 Added comments 2026-03-07 22:09:35 +01:00
cyrgani 1ff7ed583f add test for closure precedence in TokenStreams 2026-03-07 21:02:10 +00:00
bors e370b60cf2 Auto merge of #153544 - JonathanBrouwer:rollup-LT1ogBG, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#153462 (Bootstrap update)
 - rust-lang/rust#152210 (Gate #![reexport_test_harness_main] properly)
2026-03-07 20:04:00 +00:00
Jonathan Brouwer 0da3785222 Rollup merge of #152210 - Ozzy1423:attrs7, r=JonathanBrouwer
Gate #![reexport_test_harness_main] properly

Address the FIXME

Removed from `issue-43106-gating-of-builtin-attrs.rs` since that is for stable attributes only.

This would be a breaking change, search of github shows it is mostly but not always used with `#![test_runner]` which is already gated correctly.

Details:
https://github.com/rust-lang/rust/issues/50297

Feel free to close this issue if you think it is not worth addressing the FIXME...
2026-03-07 20:02:30 +01:00
Josh Stone eb093cfd5d Reformat with the new stage0 2026-03-07 10:42:02 -08:00
Jonathan Brouwer 1f124413fa Rollup merge of #153465 - obi1kenobi:pg/trailing-bracket-fix, r=aDotInTheVoid
Fix incorrect rustdoc JSON representation of `#[doc(test(..))]` attrs.

Attributes like `#[doc(test(attr(deny(rust_2018_idioms))))]` are accidentally emitted without the final `]`.

Also, the `#[doc(test(no_crate_inject))]` attribute is mistakenly emitted as `#[doc(no_crate_inject)]` — note the missing `test` wrapper.

This PR adds the missing `]` and fixes the `no_crate_inject`, and adds regression tests for both.

Thanks to the folks working on `tonic` and `pyo3` for reporting a `cargo-semver-checks` crash on Rust 1.94 in their projects, which led me to finding this bug. Refs:
- https://github.com/hyperium/tonic/actions/runs/22732044107/job/65957306230?pr=2536
- https://github.com/PyO3/pyo3/actions/runs/22745106403/job/65967167797
- https://github.com/obi1kenobi/cargo-semver-checks/issues/1590

r? @aDotInTheVoid
2026-03-07 17:37:21 +01:00
Predrag Gruevski d3149ca7aa Fix incorrect rustdoc JSON representation of #[doc(test(..))] attrs. 2026-03-06 21:14:14 -05:00
Jonathan Brouwer f540b27f90 Rollup merge of #153508 - JonathanBrouwer:improved_eager_format, r=GuillaumeGomez
Clean up the eager formatting API

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

Previously eager formatting worked by throwing the arguments into a diag, formatting, then removing the args again. This is ugly so instead we now just do the formatting completely separately.
This PR has nice commits, so I recommend reviewing commit by commit.

r? @GuillaumeGomez
2026-03-07 01:42:37 +01:00
Jonathan Brouwer cecc5e7cea Rollup merge of #153346 - WaffleLapkin:sometimes-test, r=jieyouxu
move never type tests to subdirectories and add some comments

This hopefully makes things a little bit clearer
2026-03-07 01:42:36 +01:00
Jonathan Brouwer 783c9d3de0 Rollup merge of #149937 - jyn514:linker-info, r=mati865
spliit out `linker-info` from `linker-messages`

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/149937)*

Helps with https://github.com/rust-lang/rust/issues/136096.
2026-03-07 01:42:35 +01:00
Jonathan Brouwer 7baf2be12a Fix uitests 2026-03-07 01:23:58 +01:00
Jonathan Brouwer 03a8ae8b11 Rollup merge of #153483 - aytey:dyn_paren_impl_fn_return, r=fmease
Preserve parentheses around `Fn` trait bounds in pretty printer

The AST pretty printer was dropping parentheses around `Fn` trait bounds in `dyn`/`impl` types when additional `+` bounds were present. For example:

    dyn (FnMut(&mut T) -> &mut dyn ResourceLimiter) + Send + Sync

was pretty-printed as:

    dyn FnMut(&mut T) -> &mut dyn ResourceLimiter + Send + Sync

Without parens, `+ Send + Sync` binds to the inner `dyn ResourceLimiter` instead of the outer type, producing invalid Rust.

The parser already tracks parentheses via `PolyTraitRef.parens`, but `print_poly_trait_ref` never checked this field. This adds `popen()` and `pclose()` calls when `parens == Parens::Yes`.
2026-03-06 18:49:52 +01:00
Jonathan Brouwer 69dc318464 Rollup merge of #153452 - GuillaumeGomez:migrate-diag, r=JonathanBrouwer
Cleanup unused diagnostic emission methods

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

To remove `lint_level`, we need to remove all functions calling it. One of them is `TyCtxt::node_span_lint`, so removing it.

r? @JonathanBrouwer
2026-03-06 18:49:51 +01:00
Jonathan Brouwer 56c8de6364 Rollup merge of #153189 - JayanAXHF:refactor/check_attrs_reftor_1, r=JonathanBrouwer
refactor: move `check_align` to `parse_alignment`

Part of rust-lang/rust#153101

r? @JonathanBrouwer

PS: jonathan i'm not sure about what to do with `check_align` now
2026-03-06 18:49:49 +01:00
Jonathan Brouwer 6be5b25aa9 Rollup merge of #152741 - arferreira:fix-invalid-suggestions-destructuring-drop, r=estebank,Kivooeo
Suppress invalid suggestions in destructuring assignment

Fixes rust-lang/rust#152694

When destructuring assignment hits a type with `Drop`, the compiler was emitting two broken suggestions: `ref *&mut String::new()` (invalid syntax) and `.clone()` on a temporary (useless).

Root cause: the suggestion logic didn't know these bindings were synthetic from assign desugaring. The fix reuses the existing `AssignDesugar` detection in `BindingFinder` to collect those spans and skip both suggestions.
2026-03-06 18:49:49 +01:00
Jonathan Brouwer 946e0f4924 Rollup merge of #152040 - JohnTitor:issue-151631, r=BoxyUwU
Do not emit ConstEvaluatable goals if type-const

Fixes rust-lang/rust#151631, fixes rust-lang/rust#151477
r? @fmease

I'd recommend reviewing commit-by-commit, the diff is less-readable to address a cyclic issue.
2026-03-06 18:49:48 +01:00
Jonathan Brouwer ac9bd09ec6 Rollup merge of #153495 - TaKO8Ki:fix-153236-offset-of-recovery, r=petrochenkov
Fix ICE in `offset_of!` error recovery

Fixes rust-lang/rust#153236.

`offset_of!` was changed in rust-lang/rust#148151 to lower through THIR as a sum of calls to the `offset_of` intrinsic. In the error-recovery case, when no valid field indices are recorded, that lowering synthesized `0` as a `u32` even though the overall `offset_of!` expression has type `usize`.

On 64-bit targets, const-eval then tried to write a 4-byte immediate into an 8-byte destination, which caused the ICE.
2026-03-06 18:49:48 +01:00
Jonathan Brouwer 77658bcda3 Rollup merge of #152593 - spirali:valtreekind-list, r=lcnr
Box in `ValTreeKind::Branch(Box<[I::Const]>)` changed to `List`

This is related to trait system refactoring. It fixes the FIXME in `ValTreeKind`

```
   // FIXME(mgca): Use a `List` here instead of a boxed slice
    Branch(Box<[I::Const]>),
```

It introduces `Interner::Consts`, changes `Branch(Box<[I::Const]>)` to `Branch(I::Consts)`, and updates all relevant places.

r? lcnr
2026-03-06 18:49:47 +01:00
Jonathan Brouwer 550527989e Rollup merge of #151280 - chenyukang:yukang-fix-149787, r=estebank
Fix incorrect trailing comma suggested in no_accessible_fields

Fixes rust-lang/rust#149787

r? @estebank

I think add new field for AST for it is too heavy change for this issue, here is a trivial fix with source_map, seems enough for it.
2026-03-06 18:49:46 +01:00
Waffle Lapkin 05174fbcc5 tidy never type issue-* tests 2026-03-06 17:44:18 +01:00
Takayuki Maeda ca2178dd9f add UI regression test for offset_of! recovery 2026-03-06 22:19:11 +09:00
Yuki Okushi 1190845a3d Do not emit ConstEvaluatable goals if type-const 2026-03-06 21:51:31 +09:00
Andrew V. Teylu cb66c85555 Preserve parentheses around Fn trait bounds in pretty printer
The AST pretty printer was dropping parentheses around `Fn` trait
bounds in `dyn`/`impl` types when additional `+` bounds were present.
For example:

    dyn (FnMut(&mut T) -> &mut dyn ResourceLimiter) + Send + Sync

was pretty-printed as:

    dyn FnMut(&mut T) -> &mut dyn ResourceLimiter + Send + Sync

Without parens, `+ Send + Sync` binds to the inner `dyn ResourceLimiter`
instead of the outer type, producing invalid Rust.

The parser already tracks parentheses via `PolyTraitRef.parens`, but
`print_poly_trait_ref` never checked this field. This adds `popen()`
and `pclose()` calls when `parens == Parens::Yes`.

Signed-off-by: Andrew V. Teylu <andrew.teylu@vector.com>
2026-03-06 10:38:47 +00:00
Jynn Nelson 20404bf4a6 Split out linker-info from linker-messages
- Hide common linker output behind `linker-info`
- Add tests
- Account for different capitalization on windows-gnu when removing
  "warning" prefix
- Add some more comments
- Add macOS deployment-target test
- Ignore linker warnings from trying to statically link glibc

  I don't know what's going on in `nofile-limit.rs` but I want no part
  of it.

- Use a fake linker so tests are platform-independent
2026-03-06 10:38:21 +01:00
Guillaume Gomez c98094bd32 Remove TyCtxt::node_span_lint usage from rustc_hir_typeck 2026-03-05 23:53:54 +01:00
Guillaume Gomez e1ee66935e Remove TyCtxt::node_span_lint usage from rustc_hir_analysis 2026-03-05 23:53:54 +01:00
JayanAXHF 2093158de7 refactor: move check_align to parse_alignment
* refactor: move `check_align` from check_attrs.rs to `parse_alignment`

rel: attribute parser rework
* fix: fix error messages
* test: fix test
* fix: fix invalid error message
* ops(test): Fix CI
2026-03-05 18:46:00 +00:00
Jonathan Brouwer 11c4beac1e Rollup merge of #153453 - kpreid:fix-153388, r=fmease,estebank
Fix ICEs due to incomplete typechecking on struct literals with syntax errors.

Fixes rust-lang/rust#153388.
Followup to rust-lang/rust#153227.

Today I have learned that when we don’t emit a diagnostic *specifically from typeck*, we need to call `self.infcx.set_tainted_by_errors()` to signal that the type checking is incomplete despite the lack of error.

r? fmease
2026-03-05 19:42:01 +01:00
Jonathan Brouwer 4a5a2165d2 Rollup merge of #153435 - aerooneqq:delegation_res_def_id_ice, r=petrochenkov
Fix obtaining def_id from unresolved segment

This PR fixes ICE when trying to obtain `def_id` from an unresolved segment, part of rust-lang/rust#118212, fixes rust-lang/rust#153389.

r? @petrochenkov
2026-03-05 19:42:01 +01:00
Jonathan Brouwer 9632fd893d Rollup merge of #152906 - lapla-cogito:issue_152653, r=BoxyUwU
Make `const_lit_matches_ty` check literal suffixes for exact type match

`const_lit_matches_ty` ignored literal suffixes. This let the `try_lower_anon_const_lit` fast path produce a mistyped `ty::Const::Value`, bypassing the type mismatch error that typeck would otherwise report.
2026-03-05 19:41:59 +01:00
Kevin Reid 072bd694ad Fix ICEs due to incomplete typechecking on struct literals with syntax errors. 2026-03-05 09:50:13 -08:00
bors 64b72a1fa5 Auto merge of #150447 - WaffleLapkin:maybe-dangling-semantics, r=RalfJung
Implement `MaybeDangling` compiler support



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



cc @RalfJung
2026-03-05 12:21:27 +00:00
Guillaume Gomez 25c7798004 Create new Diagnostic type for panic calls without literals 2026-03-05 12:12:31 +01:00
Waffle Lapkin d6ca5c3dc0 strip readonly/captures from MaybeDangling<&T> 2026-03-05 11:53:38 +01:00
Waffle Lapkin 8aafa53504 add semantics to MaybeDangling 2026-03-05 11:53:38 +01:00