Commit Graph

324468 Commits

Author SHA1 Message Date
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
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
Guillaume Gomez ea690c3d7b Remove AttributeLintKind::DocAutoCfgWrongLiteral variant 2026-04-20 16:59:14 +02:00
Guillaume Gomez 1aee0e07b4 Remove AttributeLintKind::DocUnknownAny variant 2026-04-20 16:54:15 +02:00
Guillaume Gomez 0ad35a24fd Remove AttributeLintKind::DocUnknownPlugins variant 2026-04-20 16:49:55 +02:00
Guillaume Gomez 7007737f11 Remove AttributeLintKind::DocUnknownPasses variant 2026-04-20 16:46:06 +02:00
Guillaume Gomez 1e57ed26db Remove AttributeLintKind::DocUnknownSpotlight variant 2026-04-20 16:46:06 +02:00
bors 91367b0f73 Auto merge of #154924 - nnethercote:rm-impl-HashStable-for-Attr-slice, r=JonathanBrouwer
Remove `HashStable` impl for `[hir::Attribute]`.



This impl skips:
- All doc comments
- A handful of other attributes, mostly `rustc_*` ones related to incremental compilation testing.
    
This skipping originated in rust-lang/rust#36025 and was extended a couple of times, e.g. in rust-lang/rust#36370. Those PRs don't have any explanation of why the skipping exists. Perhaps the reasoning was that doc comments should only affect rustdoc and rustdoc doesn't use incremental compilation? But doc comments end up in metadata, and there is a query `attrs_for_def` that returns a `&'tcx [hir::Attribute]`. So skipping some attributes just seems plainly wrong.
    
This commit removes the impl, which means `[hir::Attribute]` hashing falls back to the default impl for `[T]`. This has no noticeable effect on the test suite. It does slightly hurt performance, because of the doc comments. This perf regression seems worth it for the correctness benefits.
2026-04-20 12:55:41 +00:00
Chayim Refael Friedman 5d84f89497 Merge pull request #22101 from ChayimFriedman2/port-infer-call
fix: Port call expr type checking and closure upvar inference from rustc
2026-04-20 12:01:40 +00:00
Oli Scherer f2c79f3fc6 Handle attributes entirely in the def collector 2026-04-20 13:56:30 +02:00
Oli Scherer c8862c74b2 Avoid matching on the assoc item kind twice 2026-04-20 13:56:30 +02:00
Oli Scherer e61773669a Inline macro calls in assoc item position logic 2026-04-20 13:56:30 +02:00
Oli Scherer 690df236c2 Deduplicate the expansion field between def collection and brg 2026-04-20 13:56:30 +02:00
Oli Scherer 095f11c9ec Inline the now-trivial build_reduced_graph into its sole caller 2026-04-20 13:56:30 +02:00
Oli Scherer 0a714a26a5 Fix use trees 2026-04-20 13:53:15 +02:00
Chayim Refael Friedman d7f95de6d8 Port call expr type checking and closure upvar inference from rustc 2026-04-20 14:53:10 +03:00
Jonathan Brouwer 02dda7315a Rollup merge of #155544 - jyn514:download-rustc-verbosity, r=jieyouxu
bootstrap: Make "detected modifications" for download-rustc less verbose

cc https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/bootstrap.20lists.20all.20files.20I.20change/with/585991706, @RalfJung

r? @jieyouxu
2026-04-20 13:52:09 +02:00
Jonathan Brouwer 26f457a114 Rollup merge of #155541 - ChayimFriedman2:import-underscore, r=TaKO8Ki
Add `#[rust_analyzer::prefer_underscore_import]` to the traits in `rustc_type_ir::inherent`

This is a new attribute (https://github.com/rust-lang/rust-analyzer/pull/21740) that instructs rust-analyzer to prefer importing the trait `as _`. It is useful for these traits since their names often clashes with the type.
2026-04-20 13:52:09 +02:00
Jonathan Brouwer c4f995c1ba Rollup merge of #154772 - llogiq:nonstandard-style-perf, r=adwinwhite
slightly optimize the `non-camel-case-types` lint

This is just removing a needless `collect()` and a bit of simplification.
2026-04-20 13:52:08 +02:00
Jonathan Brouwer 7162558809 Rollup merge of #154248 - lms0806:issue_154034, r=TaKO8Ki
resolve :  mark repr_simd as internal

I changed ```repr_simd``` to ```internal``` and changed the position to ```feature-group-start: internal feature gates```.

close rust-lang/rust#154034
2026-04-20 13:52:07 +02:00
Jonathan Brouwer eceed7c1c2 Rollup merge of #155549 - nnethercote:rm-lifetimes, r=JohnTitor
Remove some unnecessary lifetimes.

We have a number of structs with more lifetimes than necessary. This commit removes them.

LLM disclosure: I asked Claude Code to check for unnecessary lifetimes in all types with three or more lifetimes, and it produced a list of candidates (half of which were invalid). I did the modifications for the valid cases myself, and found a couple more cases along the way.

r? @JohnTitor
2026-04-20 13:52:07 +02:00
Jonathan Brouwer 356fdf02ca Rollup merge of #155517 - madsmtm:test-macho-link-section-attrs, r=bjorn3
Add a test for Mach-O `#[link_section]` API inherited from LLVM

The format of the `#[link_section]` attribute is under-documented, but on Mach-O, I think it's roughly the following BNF:
```
LinkSection -> Segment `,` Section (`,` (SectionType (`,` (SectionAttributes)?)?)?)?
Segment -> <0 to 16 bytes>
Section -> <0 to 16 bytes>
SectionType -> `regular` | `zerofill` | `cstring_literals` | `4byte_literals` | `8byte_literals` | `literal_pointers` | `non_lazy_symbol_pointers` | `lazy_symbol_pointers` | `symbol_stubs` | `mod_init_funcs` | `mod_term_funcs` | `coalesced` | `interposing` | `16byte_literals` | `thread_local_regular` | `thread_local_zerofill` | `thread_local_variables` | `thread_local_variable_pointers` | `thread_local_init_function_pointers`
SectionAttributes -> SectionAttribute (`+` SectionAttribute)*
SectionAttribute -> `pure_instructions` | `no_toc` | `strip_static_syms` | `no_dead_strip` | `live_support`, `self_modifying_code` | `debug`
```

This PR adds a small test for a little part of this.

Once https://github.com/rust-lang/rust/issues/154429 is resolved, this should make it possible to test https://github.com/rust-lang/rustc_codegen_cranelift/pull/1648 end-to-end.

r? bjorn3
2026-04-20 13:52:06 +02:00
Jonathan Brouwer 1d9b32a5ac Rollup merge of #155346 - GrigorenkoPV:single-use-lifetimes, r=jdonszelmann
`single_use_lifetimes`: respect `anonymous_lifetime_in_impl_trait`

Tracking issue: rust-lang/rust#44752 (for the `single_use_lifetimes` lint; the `anonymous_lifetime_in_impl_trait` feature seems to have no tracking issue).

Closes rust-lang/rust#129255
Closes rust-lang/rust#135550

@rustbot label A-diagnostics A-lifetimes A-lints D-incorrect L-single_use_lifetimes
2026-04-20 13:52:05 +02:00
Jonathan Brouwer d83994951d Rollup merge of #155213 - petrochenkov:importvis, r=mu001999
resolve: Make sure visibilities of import declarations make sense

That they are all ordered inside the module and not more private than the module itself.

The `import_decl_vis` logic is also reused when reporting `ambiguous_import_visibilities` lint.
Some asserts are hardened.
Some relevant tests are added.

Extracted from https://github.com/rust-lang/rust/pull/154149.
2026-04-20 13:52:05 +02:00
Jonathan Brouwer 6245e371b9 Rollup merge of #154895 - Enselic:user-arg-index, r=jdonszelmann
borrowck: Apply `user_arg_index` nomenclature more broadly

No change in behavior. Only renames and a couple of added comments.

As requested here: https://github.com/rust-lang/rust/pull/154674#discussion_r3027381648

r? jdonszelmann
2026-04-20 13:52:04 +02:00
Jonathan Brouwer 3530d82c31 Rollup merge of #145270 - jakubadamw:issue-144985, r=WaffleLapkin
Fix an ICE observed with an explicit tail-call in a default trait method

Right now, explicit tail-calls cannot be used in functions that hold the `#[track_caller]` attribute. This check is performed on a resolved concrete instance of a function, which would be absent for a tail-call performed from the body of a default trait method. This PR fixes the issue by checking for the relevant attribute in default trait methods separately, without expecting a specific resolved instance.

Closes https://github.com/rust-lang/rust/issues/144985.
2026-04-20 13:52:03 +02:00
Jonathan Brouwer 3ca43dc55e Rollup merge of #154654 - bushrat011899:core_io_error_kind, r=Mark-Simulacrum
Move `std::io::ErrorKind` to `core::io`

ACP: https://github.com/rust-lang/libs-team/issues/755
Tracking issue: https://github.com/rust-lang/rust/issues/154046
Related: https://github.com/rust-lang/rust/pull/152918

## Description

I consider rust-lang/rust#154046 to be really important for `no_std`, but I'm concerned rust-lang/rust#152918 might be too controversial. As an alternative, I'd like to propose starting small with `ErrorKind`, since it can be moved somewhat trivially. It has no dependencies on functionality in `std`, no platform specific behaviour, and could provide an excellent bridging point for `no_std` IO libraries.

Since `std::io::Error` implements `From<ErrorKind>`, libraries could write functions which return `Result<T, core::io::ErrorKind>`, and therefore be usable in `std`-using libraries with the `?` operator. For that reason, I'd consider this to be a worthwhile change even if the rest of `std::io` couldn't be moved to `core`/`alloc`, and entirely compatible with any efforts to make such a change in the future.

## Notes

* This is my first PR against Rust, please let me know if there's anything I should be doing that I have not done. I tried reading through the library contributors guide but I'm sure I've missed _something_.
* No AI tooling of any kind was used in the creation of this PR.
* I believe it's appropriate that this be a part of the linked tracking issue, but please let me know if that's not the case!
2026-04-20 13:52:03 +02:00
Oli Scherer 2892564a85 Merge visit_attribute 2026-04-20 13:34:08 +02:00
Oli Scherer d67a570547 Merge visit_expr, visit_pat and visit_ty 2026-04-20 13:34:08 +02:00
Oli Scherer f69d719e1c Merge visit_field_def 2026-04-20 13:34:08 +02:00
Oli Scherer d2f476e57c Merge visit_variant 2026-04-20 13:34:08 +02:00
Oli Scherer 69aedb5ef2 Merge visit_crate 2026-04-20 13:33:48 +02:00