324986 Commits

Author SHA1 Message Date
Guillaume Gomez 6b782884e7 Remove AttributeLintKind::DoNotRecommendDoesNotExpectArgs variant 2026-04-21 19:28:46 +02:00
Guillaume Gomez a9f16fa646 Remove AttributeLintKind::AttrCrateLevelOnly variant 2026-04-21 19:28:34 +02:00
Guillaume Gomez 33b896a067 Remove AttributeLintKind::DocTestLiteral variant 2026-04-21 19:28:27 +02:00
Guillaume Gomez b1cc9a60d8 Remove AttributeLintKind::DocTestUnknown variant 2026-04-21 19:28:16 +02:00
Guillaume Gomez 2ccad45f29 Remove AttributeLintKind::DocTestTakesList variant 2026-04-21 19:27:21 +02:00
bors d2f88d4b65 Auto merge of #155599 - JonathanBrouwer:rollup-cI1hRiI, r=JonathanBrouwer
Rollup of 4 pull requests

Successful merges:

 - rust-lang/rust#152611 (Modify error message of importing inherent associated items when `#[feature(import_trait_associated_functions)]` is enabled)
 - rust-lang/rust#155359 (Improperctypes refactor2.2)
 - rust-lang/rust#155036 (Store a PathBuf rather than SerializedModule for cached modules)
 - rust-lang/rust#155554 (add warning message when using x fix)
2026-04-21 16:48:52 +00:00
Alex Crichton 1dea6b8c3b std: Update support for wasm32-wasip3
This commit performs some minor update within the standard library for
the `wasm32-wasip3` target. This target is a tier 3 target currently due
to the WASIp3 specification not being officially released. This commit
adds a dependency from the standard library on the `wasip3` crate in the
same manner as the `wasip1` and `wasip2` crates that it already depends
on. The use-sites, for randomness and environment variables, are then
updated to handle the wasip2/wasip3 multiplexing.
2026-04-21 09:26:25 -07:00
Weihang Lo 14db8ba1cf Update cargo submodule 2026-04-21 12:23:20 -04:00
lapla 90c03d8ff4 Flatten nested tuple destructuring 2026-04-22 00:24:19 +09:00
lapla a687f0b658 Fix incorrect let to const suggestion for pattern bindings 2026-04-22 00:24:08 +09:00
aerooneqq 2e6a082513 Use per-parent disambiguators 2026-04-21 18:23:40 +03:00
Jonathan Brouwer e150483f4f Rollup merge of #155554 - nivekithan:issue-155545-fix, r=jyn514
add warning message when using x fix

Fix for issue: https://github.com/rust-lang/rust/issues/155545

Before:
<img width="1880" height="329" alt="image" src="https://github.com/user-attachments/assets/b713d940-f229-4c63-8df8-93634f017793" />

After:
<img width="1897" height="387" alt="image" src="https://github.com/user-attachments/assets/5bbca701-b319-45ca-9d46-39847c50b6f8" />

Text added

```
WARNING: `x fix` is provided on a best-effort basis and does not support all `cargo fix` options correctly.
```
2026-04-21 16:53:40 +02:00
Jonathan Brouwer 8ffe107470 Rollup merge of #155036 - bjorn3:lto_refactors16, r=TaKO8Ki
Store a PathBuf rather than SerializedModule for cached modules

In cg_gcc `ModuleBuffer` already only contains a path anyway. And for moving LTO into `-Zlink-only` we will need to serialize `MaybeLtoModules`. By storing a path cached modules we avoid writing them to the disk a second time during serialization of `MaybeLtoModules`.

Some further improvements will require changes to cg_gcc that I would prefer landing in the cg_gcc repo to actually test the LTO changes in CI.

Part of https://github.com/rust-lang/compiler-team/issues/908
2026-04-21 16:53:39 +02:00
Jonathan Brouwer f21c57d8c6 Rollup merge of #155359 - niacdoial:improperctypes-refactor2.2, r=petrochenkov
Improperctypes refactor2.2

This is "part 2/3 of 2/3 of 1/2" of the original pull request https://github.com/rust-lang/rust/pull/134697 (refactor plus overhaul of the ImproperCTypes family of lints)
(all pulls of this series of pulls are supersets of the previous pulls.)
previous pull: https://github.com/rust-lang/rust/pull/155358
next pull: https://github.com/rust-lang/rust/pull/146273

This commit splits the lint's `visit_type` function into multiple functions that focus on specific things:
- visit_indirection (references, boxes, raw pointers)
- visit_variant_fields (the list of fields of a struct, enum variant, or union)
- visit_enum
- visit_struct_or_union
- visit_type (most "easy" decisions such as labeling `char` unsafe are here)

since, during these visits, we often move from an "outer type" to an "inner type" (structs, arrays, pointers, etc...),
two structs have been added to track the current state of a visit:
- VisitorState tracks the state related to the "original type" being checked (function argument/return, static variable)
- OuterTyData tracks the data related to the type "immediately outer to the current visited type"

r? petrochenkov (because you asked me to)
2026-04-21 16:53:38 +02:00
Jonathan Brouwer 04dfc2b595 Rollup merge of #152611 - CoCo-Japan-pan:fix-148009, r=jackh726
Modify error message of importing inherent associated items when `#[feature(import_trait_associated_functions)]` is enabled

Fixes rust-lang/rust#148009

This PR improves the diagnostic for importing inherent associated items from a struct or union when
`#[feature(import_trait_associated_functions)]` (rust-lang/rust#134691) is enabled.

Previously, this would result in a "not a module" error. This change provides a more specific error message clarifying that only trait associated items can be imported, while inherent associated items remain ineligible for import.

Enums are currently excluded from this change because their variants are valid import targets and require distinct handling.
2026-04-21 16:53:37 +02:00
Chris Burel e981edde2b Enable AddressSanitizer on arm-unknown-linux-gnueabihf and armv7-unknown-linux-gnueabihf
Add SanitizerSet::ADDRESS to the supported_sanitizers for the
arm-unknown-linux-gnueabihf and armv7-unknown-linux-gnueabihf targets.

The AddressSanitizer is already enabled on the armv7-linux-androideabi
platform, which shares the same ARM architecture. There is no reason
these Linux GNU targets should not also support it, as the underlying
LLVM support for ASan on 32-bit ARM is already in place.
2026-04-21 09:58:49 -04:00
CoCo-Japan-pan cbba81e0e2 Add early returns in check_trait_front_matter 2026-04-21 22:55:35 +09:00
Amanjeev Sethi 6f511f1218 Mentions rustc-docs for rustc_private
This was missing from my last PR.
Post-review.
2026-04-21 09:38:44 -04:00
CoCo-Japan-pan 470e4623db Rule out const unsafe impl from FnHeader to
correctly parse `const unsafe trait` implementations.
2026-04-21 22:17:23 +09:00
niacdoial 7bb9851ae8 ImproperCTypes: remove special cases through better state tracking
Another interal change that shouldn't impact rustc users.
Code called outside of `visit_type` (and callees) is moved inside, by
adding new types to properly track the state of a type visitation.
- OuterTyKind tracks the knowledge of the type "directly outside of" the
  one being visited (if we are visiting a struct's field, an array's
  element, etc)
- RootUseFlags tracks the knowledge of how the "original type being
  visited" is used: static variable, function argument/return, etc.
2026-04-21 15:08:51 +02:00
bors 365515367b Auto merge of #155596 - jhpratt:rollup-zyXU16X, r=jhpratt
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#155028 (tests: add whitespace tests for vertical tab behavior)
 - rust-lang/rust#155582 (Rewrite `FlatMapInPlace`.)
 - rust-lang/rust#151194 (Fix wrong suggestion for returning async closure)
 - rust-lang/rust#154377 (Fix `#[expect(dead_code)]` liveness propagation)
 - rust-lang/rust#155572 (Move diagnostic attribute target checks from check_attr)
 - rust-lang/rust#155586 (Ensure we don't feed owners from ast lowering if we ever make that query tracked)
2026-04-21 13:03:12 +00:00
Jacob Pratt b646067bfd Rollup merge of #155586 - oli-obk:assert-ignored-feed, r=petrochenkov
Ensure we don't feed owners from ast lowering if we ever make that query tracked

follow-up to rust-lang/rust#153489

I don't expect this to ever really be an issue, but better safe than sorry 😆
2026-04-21 08:22:17 -04:00
Jacob Pratt 02fc33b679 Rollup merge of #155572 - mejrs:move_target_checks, r=JonathanBrouwer,GuillaumeGomez
Move diagnostic attribute target checks from check_attr

Move diagnostic attribute target checks into their targets. Part of https://github.com/rust-lang/rust/issues/131229#issuecomment-3959910413

This is much easier with `emit_dyn_lint` :) (thanks @GuillaumeGomez !)

I think there might be some opportunity to simplify all these `check_diagnostic_*` methods in `check_attr`. However there are some diagnostic attribute prs in flight and I'd like to wait for those to land first and then think about it. So that PR is not for today.

r? @JonathanBrouwer (or @GuillaumeGomez if you want)
2026-04-21 08:22:17 -04:00
Jacob Pratt 3b4c17915e Rollup merge of #154377 - mu001999-contrib:fix/dead-code, r=TaKO8Ki
Fix `#[expect(dead_code)]` liveness propagation

Fixes https://github.com/rust-lang/rust/issues/154324
Fixes https://github.com/rust-lang/rust/issues/152370 (cc @eggyal)

Previously, when traversing from a `ComesFromAllowExpect::Yes` item (i.e., with `#[allow(dead_code)]` or `#[expect(dead_code)]`), other `ComesFromAllowExpect::Yes` items reached during propagation would be updated to `ComesFromAllowExpect::No` and inserted into `live_symbols`. That caused `dead_code` lint couldn't be emitted correctly.

After this PR, `ComesFromAllowExpect::Yes` items no longer incorrectly update other `ComesFromAllowExpect::Yes` items during propagation or mark them live by mistake, then `dead_code` lint could behave as expected.
2026-04-21 08:22:16 -04:00
Jacob Pratt 545e7dc06c Rollup merge of #151194 - chenyukang:yukang-fix-150701-async-closure, r=wesleywiser
Fix wrong suggestion for returning async closure

Fixes rust-lang/rust#150701

r? @estebank
2026-04-21 08:22:15 -04:00
Jacob Pratt eb2c80dabe Rollup merge of #155582 - nnethercote:overhaul-flat_map_in_place, r=chenyukang
Rewrite `FlatMapInPlace`.

Replace the hacky macro with a generic function and a new `FlatMapInPlaceVec` trait. More verbose but more readable and typical.

LLM disclosure: I asked Claude Code to critique this file and it suggested the generic function + trait idea. I implemented the idea entirely by hand.

r? @chenyukang
2026-04-21 08:22:14 -04:00
Jacob Pratt 2c1f01728d Rollup merge of #155028 - Brace1000:whitespace-tests, r=chenyukang
tests: add whitespace tests for vertical tab behavior

This PR adds two small tests to highlight how vertical tab (\x0B)
is handled differently across Rust's whitespace definitions.

The Rust lexer treats vertical tab as whitespace (Unicode
Pattern_White_Space), while `split_ascii_whitespace` follows the
WhatWG Infra Standard and does not include vertical tab.

These tests make that difference visible and easier to understand.

See: https://github.com/rustfoundation/interop-initiative/issues/53
2026-04-21 08:22:14 -04:00
Brian Oiko c2c486a3c0 tests: add whitespace tests for vertical tab behavior
* tests: add whitespace tests for vertical tab behavior

Add two small tests to highlight how vertical tab is handled differently.

- vertical_tab_lexer.rs checks that the lexer treats vertical tab as whitespace
- ascii_whitespace_excludes_vertical_tab.rs shows that split_ascii_whitespace does not split on it

This helps document the difference between the Rust parser (which accepts vertical tab)
and the standard library’s ASCII whitespace handling.

See: rust-lang/rust-project-goals#53
* tests: add ignore-tidy-tab directive to whitespace tests
* tests: expand vertical tab lexer test to cover all Pattern_White_Space chars
* tests: add whitespace/ README entry explaining lexer vs stdlib mismatch
* Update ascii_whitespace_excludes_vertical_tab.rs
* Update ascii_whitespace_excludes_vertical_tab.rs

make sure tabs and spaces are well checked
* Update ascii_whitespace_excludes_vertical_tab.rs
* fix tidy: add whitespace README entry
* Update README.md with missing full stop
* Update ascii_whitespace_excludes_vertical_tab.rs
* fix tidy: use full path format for whitespace README entry
* fix tidy: README order, trailing newlines in whitespace tests
* fix: add run-pass directive and restore embedded whitespace bytes
* fix tidy: remove duplicate whitespace README entry
* 

Add failing UI test for invalid whitespace (zero width space)

This adds a //@ check-fail test to ensure that disallowed whitespace
characters like ZERO WIDTH SPACE are rejected by the Rust lexer.
* git add tests/ui/whitespace/invalid_whitespace.rs
git commit -m "Fix tidy: add trailing newline"
git push
* Fix tidy: add trailing newline
* Update invalid_whitespace.rs
* Update invalid_whitespace.rs
* Clean up whitespace in invalid_whitespace.rs

Remove unnecessary blank lines in invalid_whitespace.rs
* Update invalid_whitespace.rs
* Clarify ZERO WIDTH SPACE usage in test

Update comment to clarify usage of ZERO WIDTH SPACE.
* Improve error messages for invalid whitespace

Updated error messages to clarify the issue with invisible characters.
* Modify invalid_whitespace test for clarity

Update test to check for invalid whitespace characters.
* Resolve unknown token error in invalid_whitespace.rs

Fix whitespace issue causing unknown token error.
* Remove invisible character from variable assignment

Fix invisible character issue in variable assignment.
* Improve error message for invalid whitespace

Updated error message to clarify invisible characters.
* Improve error handling for invisible characters

Updated error message for invisible characters in code.
* Document error for unknown token due to whitespace

Add error message for invalid whitespace in code
* Update error message for invalid whitespace handling
* Modify invalid_whitespace.rs for whitespace checks

Updated the test to check for invalid whitespace handling.
* Correct whitespace in variable declaration

Fix formatting issue by adding space around '=' in variable declaration.
* Update error message for invalid whitespace
* Update invalid_whitespace.stderr
* Refine error handling for invalid whitespace test

Update the error messages for invalid whitespace in the test.
* Update invalid_whitespace.rs
* Fix whitespace issues in invalid_whitespace.rs
* Update invalid_whitespace.stderr file
* Clean up whitespace in invalid_whitespace.rs

Removed unnecessary blank lines from the test file.
* Update invalid_whitespace.stderr
2026-04-21 12:20:19 +00:00
Marco Ieni c9711095bc Merge pull request #2843 from marcoieni/document-public-dashboard--again
document public dashboard (again)
2026-04-21 13:28:14 +02:00
MarcoIeni 9af3d2cc14 document public dashboard (again) 2026-04-21 13:24:14 +02:00
cyrgani 90e64771d5 merge trivial Clone tests 2026-04-21 10:53:04 +00:00
cyrgani 968ff5e331 remove and rename two deriving-bounds.rs tests 2026-04-21 10:50:12 +00:00
Waffle Lapkin be8bfb2d69 x fmt
I have no idea what caused this change, I don't think other commits
changed anything near these lines?..
2026-04-21 12:42:52 +02:00
Waffle Lapkin 54abf6d683 remove unused parameter from opt_alias_variances 2026-04-21 12:28:26 +02:00
Waffle Lapkin e8b6c9737e fix ty::UnevaluatedConst<I>>->AliasTerm<I> conversion 2026-04-21 12:28:25 +02:00
Waffle Lapkin 59be02e594 bless ui tests 2026-04-21 12:28:25 +02:00
Waffle Lapkin 0ff2fe8eef add AliasTermTy::with_args to simplify a common-ish pattern 2026-04-21 12:28:24 +02:00
Waffle Lapkin c32020d547 AliasTermTy refactor: fixup clippy 2026-04-21 12:28:23 +02:00
Waffle Lapkin c0ddfb0ec3 AliasTermTy refactor: fixup rustdoc 2026-04-21 12:28:23 +02:00
Waffle Lapkin d7986943e4 AliasTermTy refactor: fixup compiler 2026-04-21 12:28:22 +02:00
Waffle Lapkin 3484c89c0b AliasTermTy refactor: API changes 2026-04-21 12:28:21 +02:00
mejrs 3990dda860 say "implementation(s) in "not on trait impl" lints 2026-04-21 11:30:14 +02:00
mejrs 80fb0aa44e Move diagnostic::do_not_recommend target checking 2026-04-21 11:30:00 +02:00
mejrs c62be6e992 Move diagnostic::on_unknown target check 2026-04-21 11:30:00 +02:00
mejrs 59503ecb5e Move diagnostic::on_unimplemented target check 2026-04-21 11:30:00 +02:00
mejrs 26d2c30682 Move diagnostic::on_move target check 2026-04-21 11:29:59 +02:00
mejrs 5ba06cccd0 Always refer to non-const trait impls 2026-04-21 11:29:58 +02:00
mejrs 39f517fd18 Move diagnostic::on_const target check 2026-04-21 11:29:41 +02:00
bors 93637f398f Auto merge of #155583 - jhpratt:rollup-HPCle0C, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#155532 (Fix redundant boolean comparison in `Mutex::try_lock`)
 - rust-lang/rust#155558 (Clarify that isqrt returns the principal (non-negative) square root)
 - rust-lang/rust#155559 (add safety doc (section header) to two unsafe methods in `NonZero`)
 - rust-lang/rust#155564 (Implement const Default for &CStr)
 - rust-lang/rust#155565 (constify `Vec` comparisons)
2026-04-21 08:59:12 +00:00
Redddy 0c97aba201 Merge pull request rust-lang/rustc-dev-guide#2830 from DanielEScherzer/new-features-params
implementing-new-features.md: update parameters to `declare_features!`
2026-04-21 16:46:16 +09:00