Commit Graph

16912 Commits

Author SHA1 Message Date
Ralf Jung 7881a31ccf Rollup merge of #152880 - JohnTitor:tweak-assoc-item-note, r=fmease
Tweak incorrect assoc item note

Fix rust-lang/rust#142797
r? @fmease
2026-03-28 13:15:48 +01:00
Yuki Okushi 531631c7ad Make messages more generic 2026-03-28 16:18:11 +09:00
León Orell Valerian Liehr 84ecc09f66 Rollup merge of #154246 - JumpiiX:fix-101532-dead-code-warnings, r=fmease
Add test for issue #101532: dead code warnings in const _

Closes rust-lang/rust#101532

Adds a test for dead code warnings in `const _`.

This was already fixed, just adding coverage to avoid regressions.
2026-03-27 15:11:56 +01:00
León Orell Valerian Liehr 4f6837edbd Rollup merge of #154431 - TaKO8Ki:fix-explicit-reference-cast-unrelated-leaf, r=JohnTitor
Avoid ICE in explicit reference cast suggestion for unrelated leaf pr…

Fixes rust-lang/rust#154403

The explicit reference cast suggestion in was enabled based on `main_trait_predicate` being `From`/`TryFrom`, but it then extracted the source type from `leaf_trait_predicate`.

That is only valid when the leaf obligation is also part of the `From`/`TryFrom` conversion family.
2026-03-27 15:11:55 +01:00
León Orell Valerian Liehr da5a1d7684 Rollup merge of #154405 - chenyukang:yukang-fix-153096-doc-comment-bidi-help, r=JohnTitor
Improve doc comment unicode guidance

Fixes rust-lang/rust#153096

This PR does not suggest HTML bidi markup, because doc comments are still Rust source first, not only rendered rustdoc output. HTML only helps in the rendered documentation rather than making them explicit in source.
2026-03-27 15:11:54 +01:00
Yuki Okushi 1af153cdb9 Tweak incorrect assoc item note 2026-03-27 21:19:40 +09:00
bors fda6d37bb8 Auto merge of #154455 - jhpratt:rollup-I3JcUWU, r=jhpratt
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#152457 (Pass -pg to linker when using -Zinstrument-mcount)
 - rust-lang/rust#154031 (Remove divergence check from check_expr_array)
 - rust-lang/rust#154418 (move many tests out of `ui/unsafe`)
 - rust-lang/rust#154441 (bootstrap: force a CI LLVM stamp bump)
 - rust-lang/rust#153675 (simd_add/sub/mul/neg: document overflow behavior)
 - rust-lang/rust#154430 (Create GPU target notification group)
2026-03-27 09:03:50 +00:00
Jacob Pratt 483180e59c Rollup merge of #154418 - cyrgani:move-unsafe, r=chenyukang
move many tests out of `ui/unsafe`

`ui/unsafe` is a pretty big and generic directory. This PR moves some tests from it to `ui/union` and some others to a new `rustc_layout_scalar_valid_range` directory.
r? @Kivooeo
2026-03-27 02:30:07 -04:00
Jacob Pratt 28e0a47a13 Rollup merge of #154031 - TaKO8Ki:fix-153695-never-pattern-array-ice, r=chenyukang
Remove divergence check from check_expr_array

Fixes rust-lang/rust#153695.

`check_expr_array` currently assumes it should only be entered with` self.diverges == Diverges::Maybe`, but that assumption does not appear to hold in all valid cases. A never-pattern parameter can seed a function or closure body with inherited `Diverges::Always`, and exprs in that body are still typecked.
2026-03-27 02:30:06 -04:00
bors e3691a5bd5 Auto merge of #154361 - nnethercote:rustc_hir_analysis-rustc_lint, r=davidtwco
Make `rustc_hir_analysis` not depend on `rustc_lint`.

`rustc_hir_analysis` depends on `rustc_lint` in just a single function: `emit_delayed_lint`, which is used by the
"emit_ast_lowering_delayed_lints" checking section within `rustc_hir_analysis::check_crate`.

This commit moves that function and section to out of `rustc_hir_analysis::check_crate`, into `rustc_interface`, eliminating the dependency. This seems reasonable because the delayed lint errors aren't really related to HIR analysis, they were in there just because HIR analysis is what follows AST lowering.

This means `rustc_hir_analysis` and `rustc_lint` can both start compiling as soon as `rustc_trait_selection` finishes. This also changes the error order in one test, which doesn't matter.

The commit also changes `emit_delayed_lint` to `emit_delayed_lints`, factoring out some code duplicated in rustdoc.

r? @davidtwco
2026-03-27 05:56:33 +00:00
bors ac40f5e105 Auto merge of #154004 - GrigorenkoPV:alignment/as_nonzero_usize, r=scottmcm
`Alignment`: move from `ptr` to `mem` and rename `as_nonzero` to `as_nonzero_usize`



- tracking issue: rust-lang/rust#102070
- split off from rust-lang/rust#153261
2026-03-27 01:25:29 +00:00
Takayuki Maeda 741a3a7fc4 avoid ICE in explicit reference cast suggestion for unrelated leaf predicates 2026-03-27 01:26:51 +09:00
Jonathan Brouwer 4afdad4fae Rollup merge of #154354 - ywxt:more-parallel-tests, r=petrochenkov
Add more tests for the parallel frontend

Add corresphonding tests from issues:
- rust-lang/rust#115223
- rust-lang/rust#151358
- rust-lang/rust#120757
- rust-lang/rust#134978
- rust-lang/rust#120786
- rust-lang/rust#129911
- rust-lang/rust#129912
- rust-lang/rust#151226
- rust-lang/rust#142064
- rust-lang/rust#120759

For rust-lang/rust#119785
> Effects is no more and the implementation of const_trait_impl has changed dramatically. This is obviously fixed. I don't think it's worth adding a regression test. If you disagree, feel free to open a PR and ping [@]rust-lang/project-const-traits for a "majority vote".

So it doesn't appear here.

And  rust-lang/rust#142949 has flipflopping diagnostics

r? @petrochenkov
2026-03-26 15:20:10 +01:00
cyrgani b5605cd6ab move many tests out of ui/unsafe 2026-03-26 10:43:49 +00:00
bors 3a933e5bf5 Auto merge of #154412 - JonathanBrouwer:rollup-4EpQJse, r=JonathanBrouwer
Rollup of 2 pull requests

Successful merges:

 - rust-lang/rust#154229 (Ensure `ErasedData` only implements appropriate auto traits)
 - rust-lang/rust#154409 (Update `try_blocks` to a new tracking issue number)
2026-03-26 08:42:44 +00:00
ywxt 224eda09e6 Add more tests for the parallel frontend 2026-03-26 16:08:34 +08:00
Jonathan Brouwer e06b9bbd5c Rollup merge of #154409 - scottmcm:change-try-tracking, r=TaKO8Ki
Update `try_blocks` to a new tracking issue number

New tracking issue https://github.com/rust-lang/rust/issues/154391
Closes rust-lang/rust#31436
2026-03-26 08:16:53 +01:00
Scott McMurray 4a31988c75 Update try_blocks to a new tracking issue number 2026-03-25 23:04:10 -07:00
bors 3ea2fbcb2a Auto merge of #154010 - estebank:issue-42753, r=nnethercote
Suggest using equality comparison instead of pattern matching on non-structural constant in pattern

When encountering a pattern containing a non-structural constant (not marked as `#[derive(PartialEq)]` to make it suitable for pattern matching, `C` in the examples below), we would previously not provide additional guidance. With this PR, the `help` in the following examples are added:

```
error: constant of non-structural type `partial_eq::S` in a pattern
  --> $DIR/suggest_equality_comparison_instead_of_pattern_matching.rs:16:18
   |
LL |     struct S;
   |     -------- `partial_eq::S` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL |     const C: S = S;
   |     ---------- constant defined here
...
LL |             Some(C) => {}
   |                  ^ constant of non-structural type
   |
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
  --> $DIR/suggest_equality_comparison_instead_of_pattern_matching.rs:5:5
   |
LL |     impl PartialEq<S> for S {
   |     ^^^^^^^^^^^^^^^^^^^^^^^
help: add a condition to the match arm checking for equality
   |
LL -             Some(C) => {}
LL +             Some(binding) if binding == C => {}
   |
```

```
error: constant of non-structural type `partial_eq::S` in a pattern
  --> $DIR/suggest_equality_comparison_instead_of_pattern_matching.rs:22:18
   |
LL |     struct S;
   |     -------- `partial_eq::S` must be annotated with `#[derive(PartialEq)]` to be usable in patterns
...
LL |     const C: S = S;
   |     ---------- constant defined here
...
LL |         let Some(C) = Some(S) else { return; };
   |                  ^ constant of non-structural type
   |
note: the `PartialEq` trait must be derived, manual `impl`s are not sufficient; see https://doc.rust-lang.org/stable/std/marker/trait.StructuralPartialEq.html for details
  --> $DIR/suggest_equality_comparison_instead_of_pattern_matching.rs:5:5
   |
LL |     impl PartialEq<S> for S {
   |     ^^^^^^^^^^^^^^^^^^^^^^^
help: check for equality instead of pattern matching
   |
LL -         let Some(C) = Some(S) else { return; };
LL +         if Some(C) == Some(S) { return; };
   |
```

The suggestion accounts for a few conditions:

 - if the type is not from the local crate and has no `PartialEq` impl, the user can't make it structural, so we don't provide the suggestion
 - regardless of whether the type is local or remote, if it has a manual `PartialEq`, explain that with a derived `PartialEq` you could use equality
 - if the type is local and has no impl, suggest adding a derived `PartialEq` and use equality check instead of pattern matching
 - when suggesting equality, account for `if-let` to suggest chaining (edition dependent), `match` arm with a present `if` check, `match` arm without an existing `if` check
 - when encountering `let-else`, we suggest turning it into an `if` expression instead (this doesn't check for additional bindings beyond the constant, which would suggest incorrect code in some more complex cases).

Fix rust-lang/rust#42753.
2026-03-26 05:30:08 +00:00
yukang 16b9fddf00 Improve doc comment unicode guidance 2026-03-26 11:42:38 +08:00
Nicholas Nethercote a733192980 Make rustc_hir_analysis not depend on rustc_lint.
`rustc_hir_analysis` depends on `rustc_lint` in just a single function:
`emit_delayed_lint`, which is used by the
"emit_ast_lowering_delayed_lints" checking section within
`rustc_hir_analysis::check_crate`.

This commit moves that function and section to out of
`rustc_hir_analysis::check_crate`, into `rustc_interface`, eliminating
the dependency. This seems reasonable because the delayed lint errors
aren't really related to HIR analysis. They were in there just because
HIR analysis follows AST lowering.

This means `rustc_hir_analysis` and `rustc_lint` can both start
compiling as soon as `rustc_trait_selection` finishes. This also changes
the error order in one test, which doesn't matter.

The commit also changes `emit_delayed_lint` to `emit_delayed_lints`,
factoring out some code duplicated in rustdoc.
2026-03-26 14:31:43 +11:00
bors 6d8bc65fc8 Auto merge of #154390 - JonathanBrouwer:rollup-y369aHY, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#153068 (Require avxvnni for avx10.2)
 - rust-lang/rust#154359 (Add regression test for rust-lang/rust#154189)
 - rust-lang/rust#154386 (Migrate UI tests)
2026-03-26 02:21:29 +00:00
Jonathan Brouwer c8d729b72a Rollup merge of #154386 - ujjwalvishwakarma2006:migrate-ui-tests, r=Kivooeo
Migrate UI tests

In this pull request, I am migrating the following files and adding a comment at the top, including a link to the issue they were regression tests for:
- `tests/ui/issues/issue-4735.rs` ➝ `tests/ui/drop/drop-noncopyable-raw-pointer.rs`
- `tests/ui/issues/issue-17734.rs` ➝ `tests/ui/codegen/box-str-drop-glue.rs`

r? Kivooeo
2026-03-26 00:23:15 +01:00
Jonathan Brouwer cbe9a4bd42 Rollup merge of #154359 - TaKO8Ki:fix-154189-generalize-associated-type-alias, r=Kivooeo
Add regression test for #154189

Fixes rust-lang/rust#154189
2026-03-26 00:23:14 +01:00
bors 1174f78409 Auto merge of #154014 - Unique-Usman:ua/decmacrounrepeatable2, r=estebank
rustc_expand: improve diagnostics for non-repeatable metavars



There was an initally opened pr which solve this issue here https://github.com/rust-lang/rust/pull/152679. It got merged but, there was a perf regression. And this new pr is opened to address the problem. The first did the computation of binding and matched_rule and then passed them as owned value down to `diagnostics::emit_frag_parse_err(` but, now this pr address the issue by passing `lhs` and `rules` as borrowed value to from_tts and the move the logic to `diagnostics::emit_frag_parse_err(`.

Fix https://github.com/rust-lang/rust/issues/47452.
2026-03-25 23:14:18 +00:00
ujjwalVishwakarma2006 ff29b41054 Add issue link at the top in files tests/ui/codegen/box-str-drop-glue.rs and tests/ui/drop/drop-noncopyable-raw-pointer.rs 2026-03-26 03:12:06 +05:30
ujjwalVishwakarma2006 f7b3e88947 Rename two test files 2026-03-26 01:50:12 +05:30
Jonathan Brouwer 4e443455b4 Rollup merge of #154355 - aerooneqq:const-types-ices, r=petrochenkov
delegation: add const type ICE test

This PR adds test for rust-lang/rust#154334 which was fixed by rust-lang/rust#154142. Fixes rust-lang/rust#154334. Part of rust-lang/rust#118212.

r? @petrochenkov
2026-03-25 19:53:01 +01:00
Jonathan Brouwer 4b9e6557dd Rollup merge of #154233 - kyleecodes:tests/reorg-ui-issues, r=Kivooeo
Move ui/issues tests to relevant subdirectories

Related to https://github.com/rust-lang/rust/issues/133895 and [Reorganisation of tests/ui/issues for GSOC](https://github.com/rust-lang/google-summer-of-code?tab=readme-ov-file#reorganisation-of-testsuiissues)

This is the first PR in a batch of PRs.

Moves `ui/issues/issue-17546.rs‎`  ‎-> `ui/variants/variant-result-noresult-used-as-type.rs`

Approach:
1. Check linked issue and test contents, determine new target directory
2. Move / rename tests to reflect purpose.
3. Add issue link / comments in separate commit.
4. Rebless if necessary and remove obsolete stderr.

r? @Kivooeo
2026-03-25 19:53:00 +01:00
Jonathan Brouwer 8ae423e5e8 Rollup merge of #154230 - aryannrd:issue-50411, r=Kivooeo
Moved and rename issue-50411 to tests/ui/mir/inliner-double-elaborate
2026-03-25 19:52:59 +01:00
Jonathan Brouwer 7381bbba99 Rollup merge of #154131 - cyrgani:structs-enums, r=Kivooeo
begin `tests/ui/structs-enums` cleanup

Nearly all tests in this directory are heavily outdated, poorly formatted and have a lot of duplication. This PR is the first of a planned series of PRs to combinine this, `ui/structs` and `ui/enum` into a better structure (`ui/adt` maybe?).
2026-03-25 19:52:58 +01:00
Jonathan Brouwer a376772bc1 Rollup merge of #154112 - cyrgani:macros-folder, r=Kivooeo
some `tests/ui/macros` cleanup

Move most tests that do not run any code from `//@ run-pass` to `//@ check-pass` and merge the (outdated) `die-macro-*` tests into one file.
2026-03-25 19:52:57 +01:00
Jonathan Brouwer 047dee4665 Rollup merge of #154090 - danieljofficial:move-tests-statics, r=Kivooeo
Move tests in the statics category

I have moved some tests I feel belong in the statics directory. Please review and let me know if this is the correct way. I think on the first two files I moved, i forgot to turn off rust analyzer and it probably formatted the files, will this be an issue?
2026-03-25 19:52:57 +01:00
Jonathan Brouwer c13e9ec32b Rollup merge of #154364 - aerooneqq:delegation-generics-small-fixes, r=petrochenkov
delegation: don't propagate synthetic params, remove lifetime hacks

Some small fixes after new delegation lowering was merged: remove lifetime hacks as now we get only early-bound lifetimes from generics, don't propagate synthetic generic params as now we know that they are synthetic. Fixes rust-lang/rust#143498. Part of rust-lang/rust#118212.

r? @petrochenkov
2026-03-25 19:52:56 +01:00
Jonathan Brouwer 145917253d Rollup merge of #154363 - aerooneqq:nested-delegations, r=petrochenkov
delegation: fix zero-args nested delegation ICE

This PR fixes an ICE when during lowering of nested delegation we need to access information about its parent, who is also inside body of another delegation. As a fix we lower delegation body even if there are no arguments in signature function, in this case we will see an error `this function takes 0 arguments but 1 argument was supplied`. Fixes rust-lang/rust#154332. Part of rust-lang/rust#118212.

r? @petrochenkov
2026-03-25 19:52:55 +01:00
Jonathan Brouwer 85ddb8e414 Rollup merge of #154313 - mu001999-contrib:fix/154295, r=petrochenkov
Init `self_decl` with a correct visibility

Fixes rust-lang/rust#154295

r? petrochenkov
2026-03-25 19:52:52 +01:00
Jonathan Brouwer 6e3c17424d Rollup merge of #153702 - SpriteOvO:guard-matcher, r=davidtwco
Add macro matcher for `guard` fragment specifier

Tracking issue #153104

This PR implements a new `guard` macro matcher to match `if-let` guards (specifically [`MatchArmGuard`](https://github.com/rust-lang/reference/blob/50a1075e879be75aeec436252c84eef0fad489f4/src/expressions/match-expr.md#match-guards)). In the upcoming PR, we can use this new matcher in the `matches!` and `assert_matches!` macros to support their use with `if-let` guards. (see #152313)

The original `Expr` used to represent a guard has been wrapped in a new `Guard` type, allowing us to carry the span information of the leading `if` keyword. However, it might be even better to include the `if` keyword in the `Guard` type as well? I've left a FIXME comment in the code.
2026-03-25 19:52:50 +01:00
Jonathan Brouwer 0cd8de3843 Rollup merge of #153049 - Darksonn:kasan-sw-tags, r=fmease
Add `-Zsanitize=kernel-hwaddress`

The Linux kernel has a config option called `CONFIG_KASAN_SW_TAGS`  that enables `-fsanitize=kernel-hwaddress`. This is not supported by Rust.

One slightly awkward detail is that `#[sanitize(address = "off")]` applies to both `-Zsanitize=address` and `-Zsanitize=kernel-address`. Probably it was done this way because both are the same LLVM pass. I replicated this logic here for hwaddress, but it might be undesirable.

Note that `#[sanitize(kernel_hwaddress = "off")]` could be supported as an annotation on statics, but since it's also missing for `#[sanitize(hwaddress = "off")]`, I did not add it.

MCP: https://github.com/rust-lang/compiler-team/issues/975
Tracking issue: https://github.com/rust-lang/rust/issues/154171

cc @rcvalle @maurer @ojeda
2026-03-25 19:52:49 +01:00
mu001999 01795c3eab Init self_decl with a correct vis 2026-03-25 21:41:33 +08:00
Pavel Grigorenko f8d658ab81 core: move Alignment from ptr to mem 2026-03-25 16:18:33 +03:00
Aryan Dubey 2a543acbaf Moved and rename issue-50411 to tests/ui/mir/inliner-double-elaborate
* Move issue-50411 to tests/ui/mir/inliner-double-elaborate
* Addded the link for the issue to inliner-double-elaborate.rs
* Fix tidy issues
* Renamed to inliner-double-elaborate.rs
2026-03-25 10:13:13 +00:00
aerooneqq c2383b53a2 Don't propagate synthetic params, remove lifetime hacks 2026-03-25 13:04:03 +03:00
danieljofficial bca30d4828 add issue link comments and bless 2026-03-25 10:49:21 +01:00
aerooneqq 11a338deb6 Fix nested zero-args delegation ICE 2026-03-25 12:08:31 +03:00
Takayuki Maeda 08e064a9cb add regression test for 154189
fix ci errors
2026-03-25 17:39:17 +09:00
aerooneqq 735c3e457e Add const type ICE test 2026-03-25 09:27:46 +03:00
kyleecodes 62ba3c1022 Move ui/issues tests to relevant subdirectories
* tests(ui): migrate issues/issue-17546 to ui/resolve
* tests(ui): add gh issue link
* tests(ui/issues): move tests to variants dir
2026-03-25 00:35:04 +00:00
bors 8a703520e8 Auto merge of #154339 - JonathanBrouwer:rollup-FPeeGxJ, r=JonathanBrouwer
Rollup of 3 pull requests

Successful merges:

 - rust-lang/rust#154311 ([libcore] Disable `doc(auto_cfg)` for integers trait impls)
 - rust-lang/rust#154331 (allow `incomplete_features` in all ui tests)
 - rust-lang/rust#154336 (Remove more BuiltinLintDiag variants - part 3)
2026-03-24 22:00:08 +00:00
cyrgani 97e84d5a56 allow incomplete_features in all ui tests 2026-03-24 20:00:26 +00:00
bors 362211dc29 Auto merge of #154326 - JonathanBrouwer:rollup-MflIdQW, r=JonathanBrouwer
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#152710 (Unalign `PackedFingerprint` on all hosts, not just x86 and x86-64)
 - rust-lang/rust#153874 (constify const Fn*: Destruct)
 - rust-lang/rust#154097 (improve validation error messages: show surrounding type)
 - rust-lang/rust#154277 (use `minicore` more in testing inline assembly)
 - rust-lang/rust#154293 (Use verbose span suggestion for type const)
2026-03-24 18:37:19 +00:00