Commit Graph

324507 Commits

Author SHA1 Message Date
Guillaume Gomez 80777dd748 Reorder emails of Guillaume Gomez so it appears as its primary email and not the old one 2026-04-21 19:28:54 +02:00
Guillaume Gomez 940d0f8245 Remove AttributeLintKind::UnknownCrateTypesSuggestion variant 2026-04-21 19:28:53 +02:00
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 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
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
Oli Scherer b1c7595965 Ensure we don't feed owners from ast lowering if we ever make that query tracked 2026-04-21 08:56:02 +02:00
Jacob Pratt b4bab32075 Rollup merge of #155565 - Lars-Schumann:const-vec-cmp, r=jhpratt
constify `Vec` comparisons

Tracking Issue: https://github.com/rust-lang/rust/issues/143800

Due to `Cow` not implementing `const Deref` (https://github.com/rust-lang/rust/issues/147964), the comparisons including a `Cow` were not constified.
2026-04-21 02:20:28 -04:00
Jacob Pratt 53b9b9a108 Rollup merge of #155564 - tshakalekholoane:tshaka/const_default/cstr, r=jhpratt
Implement const Default for &CStr

Implements `const Default` for `&CStr`.

Tracking issue: rust-lang/rust#143894.
2026-04-21 02:20:27 -04:00
Jacob Pratt 64b897180d Rollup merge of #155559 - safer-rust:fix-doc2, r=jhpratt
add safety doc (section header) to two unsafe methods in `NonZero`

This PR adds a Safety section to two unsafe methods in `NonZero`:
- [unchecked_add](https://doc.rust-lang.org/nightly/core/num/struct.NonZero.html#method.unchecked_add)
- [unchecked_mul](https://doc.rust-lang.org/nightly/core/num/struct.NonZero.html#method.unchecked_mul)

The safety documentation is now consistent with that of [`u8::unchecked_add`](https://doc.rust-lang.org/nightly/core/primitive.u8.html#method.unchecked_add) and [`u8::unchecked_mul`](https://doc.rust-lang.org/nightly/core/primitive.u8.html#method.unchecked_mul).
2026-04-21 02:20:26 -04:00
Jacob Pratt 156cc9fb23 Rollup merge of #155558 - nivekithan:issue-154000-fix, r=jhpratt
Clarify that isqrt returns the principal (non-negative) square root

Clarify which root is returned from `isqrt` and `checked_isqrt`

Fixes: https://github.com/rust-lang/rust/issues/154000
Previous PRs: https://github.com/rust-lang/rust/pull/154462
2026-04-21 02:20:26 -04:00
Jacob Pratt 387df6efb1 Rollup merge of #155532 - StepfenShawn:patch-1, r=jhpratt
Fix redundant boolean comparison in `Mutex::try_lock`

Simplify boolean return in `Mutex::try_lock`.
Replace `expr == false` with `!expr` for cleaner code.
2026-04-21 02:20:25 -04:00
Nicholas Nethercote 21cd762cd1 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.
2026-04-21 15:52:55 +10:00
bors 9ab01ae53c Auto merge of #155491 - ohadravid:faster-storage-in-copyprop-and-gvn, r=saethlin
Fix performance regression introduced in #142531 by excluding `Storage{Live,Dead}` from CGU size estimation



Fix performance regression introduced in rust-lang/rust#142531 ([rust-timer comment](https://github.com/rust-lang/rust/pull/142531#issuecomment-4273712294)) by excluding `Storage{Live,Dead}` from CGU size estimation.

Also, avoid unneeded work for storage removal in non-opt builds in CopyProp and GVN
by allocating local sets for the storage accounting only when `tcx.sess.emit_lifetime_markers()`. 

r? saethlin
2026-04-21 05:35:16 +00:00
bors 84c1190072 Auto merge of #155576 - jhpratt:rollup-F5kv4Uy, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#153411 (Offload slice support)
 - rust-lang/rust#154557 (Make E0284 generic argument suggestions more explicit)
 - rust-lang/rust#154933 (Suggest removing `&` when awaiting a reference to a future)
 - rust-lang/rust#155524 (Fix LLVM offload install docs to use semicolon-separated CMake lists)
 - rust-lang/rust#155568 (Update books)
2026-04-21 02:16:22 +00:00
Jacob Pratt c7ccec1549 Rollup merge of #155568 - rustbot:docs-update, r=ehuss
Update books

## rust-embedded/book

2 commits in 2463edeb8003c5743918b3739a9f6870b86396f5..0789b0f29e73ecb91213cac10ad0eec1b9333770
2026-04-11 08:46:22 UTC to 2026-04-10 14:01:38 UTC

- remove IO chapter, is covered in next chapter (rust-embedded/book#411)
- add embassy chapter (rust-embedded/book#412)

## rust-lang/reference

10 commits in d2715c07e9dd9839c0c7675ecfa18bec539a6ee9..8c88f9d0bdd75ffdc0691676d83212ae22a18cee
2026-04-20 15:20:24 UTC to 2026-04-07 16:25:09 UTC

- typo in example code (rust-lang/reference#2232)
- oxford comma (rust-lang/reference#2233)
- improve readability (rust-lang/reference#2234)
- typo (rust-lang/reference#2230)
- Clarify items.fn.generics.param-bounds (rust-lang/reference#2229)
- follow formatting style guideline (rust-lang/reference#2228)
- Update `derive` export locations (rust-lang/reference#2223)
- Clarify that `{self}` imports require a module parent (rust-lang/reference#2221)
- stabilize s390x vector registers (rust-lang/reference#2215)
- Fix misuse of *usage* throughout the Reference (rust-lang/reference#2222)

## rust-lang/rust-by-example

2 commits in b31e3b8da01eeba0460f86a52a55af82709fadf5..898f0ac1479223d332309e0fce88d44b39927d28
2026-04-19 11:40:28 UTC to 2026-04-19 11:38:45 UTC

- remove debug printing for the u32 and bool in variable_bindings.md (rust-lang/rust-by-example#1999)
- Update for.md (rust-lang/rust-by-example#2008)
2026-04-20 20:50:23 -04:00
Jacob Pratt adce5da870 Rollup merge of #155524 - sharesth23:fixing-llvm-doc, r=ZuseZ4
Fix LLVM offload install docs to use semicolon-separated CMake lists

Update  so the LLVM CMake example uses  and , which is the correct list separator syntax for LLVM CMake options.[Docs] Remove shortcode from models page heading
2026-04-20 20:50:22 -04:00
Jacob Pratt 03dc6a3a28 Rollup merge of #154933 - fru1tworld:fix-87211-ref-future-diagnostic, r=chenyukang
Suggest removing `&` when awaiting a reference to a future

Fixes rust-lang/rust#87211

When `.await`ing `&impl Future`, suggest removing the `&` instead of removing `.await`.
2026-04-20 20:50:22 -04:00
Jacob Pratt a8e1664fd8 Rollup merge of #154557 - Muhtasim-Rasheed:issue-147313-improve-help, r=chenyukang
Make E0284 generic argument suggestions more explicit

Closes rust-lang/rust#147313

Previously, when type annotations were missing for a function call, rust suggested: "consider specifying the generic argument". This PR improves the diagnostics:

- If only one generic type is missing:
  "consider specifying a concrete type for the generic type `<T>`" with the turbofish being "::\<SomeConcreteType>"
- If only one const generic is missing:
  "consider specifying a const for the const generic `<CONST>`" with the turbofish being "::<SOME_CONST>"

Multiple missing generics still produce the original more general suggestion
2026-04-20 20:50:21 -04:00
Jacob Pratt 4c7e6565ef Rollup merge of #153411 - Sa4dUs:offload-slices, r=ZuseZ4
Offload slice support

This PR allows offload to support slice type arguments.

~NOTE: this is built on top of https://github.com/rust-lang/rust/pull/152283~

r? @ZuseZ4
2026-04-20 20:50:20 -04:00
bors 4fbae3e309 Auto merge of #154945 - oli-obk:merge-visitors-def-collector-brg, r=petrochenkov
Merge BuildReducedGraphVisitor into DefPathVisitor

These two visitors run right after each other on the same immutable AST. There's also a hash map for transferring the TyCtxtFeed created in the def collector to the BRG when it visits the same items. There are possibly more avenues for sharing logic, but I want to keep this PR simple.

only opening for perf runs for now. I'm still investigating how to ensure that future changes don't introduce subtle bugs by forgetting that def collection and reduced graph building are one pass now

Best reviewed commit-by-commit. I took a lot of care for making the individual changes reviewable, but all the `Merge *` commits aren't able to compile libcore until the last one.
2026-04-20 23:10:06 +00:00
Eric Huss 69dae5941e Update shebang reference rule names
This updates the rule names for shebang which were changed in
rust-lang/reference#2192 and rust-lang/reference#2199.
2026-04-20 15:08:37 -07:00
bors 66da6cae1a Auto merge of #155567 - JonathanBrouwer:rollup-0zpjwMk, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#155556 (`rust-analyzer` subtree update)
 - rust-lang/rust#152162 (Suggest returning a reference for unsized place from a closure)
 - rust-lang/rust#155389 (Simplify macros for target-modifier and mitigation flags)
 - rust-lang/rust#155553 (miri subtree update)
 - rust-lang/rust#153546 (tests/ui/extern: add annotations for reference rules)
 - rust-lang/rust#155475 (Make reparsed guard metavars collect tokens)
 - rust-lang/rust#155560 (Remove `AttributeLintKind` variants - part 4)
2026-04-20 19:35:12 +00:00
Marcelo Domínguez af839a8a96 Add offload slice support 2026-04-20 19:15:52 +02:00
rustbot 231acce8cc Update books 2026-04-20 19:00:33 +02:00
Jonathan Brouwer ca0710af53 Rollup merge of #155560 - GuillaumeGomez:rm-attributelintkind, r=JonathanBrouwer
Remove `AttributeLintKind` variants - part 4

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

r? @JonathanBrouwer
2026-04-20 18:57:04 +02:00
Jonathan Brouwer 13b537002b Rollup merge of #155475 - cijiugechu:missing-tokens, r=jieyouxu
Make reparsed guard metavars collect tokens

This should avoid missing tokens.

Closes rust-lang/rust#155333
2026-04-20 18:57:03 +02:00
Jonathan Brouwer caa265ec8b Rollup merge of #153546 - DanielEScherzer:test-references-extern, r=ehuss
tests/ui/extern: add annotations for reference rules
2026-04-20 18:57:03 +02:00
Jonathan Brouwer 1b64473ea4 Rollup merge of #155553 - RalfJung:miri, r=RalfJung
miri subtree update

Subtree update of `miri` to https://github.com/rust-lang/miri/commit/16dd940bb92f3ed98f588a5dbe58efe005d10ffc.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-04-20 18:57:02 +02:00
Jonathan Brouwer 074ed7b651 Rollup merge of #155389 - Zalathar:flag-macros, r=mati865
Simplify macros for target-modifier and mitigation flags

- Rebased and revised version of https://github.com/rust-lang/rust/pull/154501.
---

The macros used for handling command-line flags that are “target modifiers” or “mitigations” are quite complicated, and can be significantly simplified by tweaking their syntax and by making use of `${ignore(..)}` metavars.

It's possible that more code could be moved out of macros (e.g. declaring some of the enums by hand), but that can be investigated in a potential follow-up.

There should be no change to compiler behaviour.
2026-04-20 18:57:01 +02:00
Jonathan Brouwer 515c670b35 Rollup merge of #152162 - chenyukang:yukang-fix-152064-unsized-closure-return, r=petrochenkov
Suggest returning a reference for unsized place from a closure

Fixes rust-lang/rust#152064

There are 3 similar note:
`the size for values of type str cannot be known at compilation time`
for different spans, maybe need more work to remove some of them.

This PR only adds a suggestion for using a reference.
2026-04-20 18:57:00 +02:00
Jonathan Brouwer 64d875f6c2 Rollup merge of #155556 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to https://github.com/rust-lang/rust-analyzer/commit/cc5bc48b256d8c996a98fa13ae52a0af29b302fa.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-04-20 18:56:59 +02:00
bors c28e303778 Auto merge of #155552 - JonathanBrouwer:rollup-JKIpTuW, r=JonathanBrouwer
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#154654 (Move `std::io::ErrorKind` to `core::io`)
 - rust-lang/rust#145270 (Fix an ICE observed with an explicit tail-call in a default trait method)
 - rust-lang/rust#154895 (borrowck: Apply `user_arg_index` nomenclature more broadly)
 - rust-lang/rust#155213 (resolve: Make sure visibilities of import declarations make sense)
 - rust-lang/rust#155346 (`single_use_lifetimes`: respect `anonymous_lifetime_in_impl_trait`)
 - rust-lang/rust#155517 (Add a test for Mach-O `#[link_section]` API inherited from LLVM)
 - rust-lang/rust#155549 (Remove some unnecessary lifetimes.)
 - rust-lang/rust#154248 (resolve :  mark repr_simd as internal)
 - rust-lang/rust#154772 (slightly optimize the `non-camel-case-types` lint)
 - rust-lang/rust#155541 (Add `#[rust_analyzer::prefer_underscore_import]` to the traits in `rustc_type_ir::inherent`)
 - rust-lang/rust#155544 (bootstrap: Make "detected modifications" for download-rustc less verbose)
2026-04-20 16:15:13 +00:00