325884 Commits

Author SHA1 Message Date
Rust timing bot 8c4ed4d0e0 Unrolled build for #151122
Rollup merge of #151122 - Jaidenmagnan:main, r=chenyukang

fix: more descriptive error message for enum to integer

Fixes rust-lang/rust#151116
A  more descriptive error message when casting an enum to an Integer. Please review issue linked above.
2026-05-06 15:58:56 +02:00
Jaiden Magnan 0f5d89fea1 fix: CopyPriority addition 2026-05-05 17:34:50 -04:00
Jaiden Magnan 61743bf3b0 fix: adding more verbose error message 2026-05-05 16:19:41 -04:00
bors e95e73209f Auto merge of #156190 - JonathanBrouwer:rollup-db0KRf1, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#156014 (resolve: Catch "cannot reexport" errors from macros 2.0 better)
 - rust-lang/rust#156058 (Print HRTB binders before fn qualifiers)
 - rust-lang/rust#156172 (Implement a new flag `-Zdisable-fast-paths` in trait solving)
 - rust-lang/rust#156184 (Revert "remove `MethodReceiverExpr` special-casing")
 - rust-lang/rust#155957 (Revert const hacks and use const closures in std)
 - rust-lang/rust#156127 (Update `askama` version to `0.16.0`)
 - rust-lang/rust#156183 (Remove duplicate debug assert)
2026-05-05 19:36:08 +00:00
bors 740679e1f5 Auto merge of #154861 - mehdiakiki:fix/rlib-digest, r=petrochenkov
Add rlib digest to identify Rust object files



This adds a metadata entry to `rlib` archives that lists which members are Rust object files instead of relying on the filename heuristic in `looks_like_rust_object.file`. I also added a fallback to the old behavior for `rlibs` built by older compilers. 

Part of https://github.com/rust-lang/rust/issues/138243.
2026-05-05 16:26:33 +00:00
Jonathan Brouwer e20ac1b606 Rollup merge of #156183 - zetanumbers:rm_duplicate_dbg_ass, r=mati865
Remove duplicate debug assert

This is this.
2026-05-05 14:25:27 +02:00
Jonathan Brouwer c2a463a5d0 Rollup merge of #156127 - GuillaumeGomez:update-askama, r=Urgau
Update `askama` version to `0.16.0`

New features and bugfixes. Full changelog is [here](https://github.com/askama-rs/askama/releases/tag/v0.16.0).

r? @Urgau
2026-05-05 14:25:26 +02:00
Jonathan Brouwer 2e9a40258c Rollup merge of #155957 - oli-obk:const-closure-std, r=jhpratt
Revert const hacks and use const closures in std

This revealed some smaller bugs in stability checking that I fixed where needed:

* const closures use the const stability of their parent
* trait method default bodies use the const stability of their trait

Otherwise trivial reverts of the const hacks that were added

fixes rust-lang/rust#155781
2026-05-05 14:25:25 +02:00
Jonathan Brouwer 17e266a1ae Rollup merge of #156184 - cyrgani:macros-are-weird, r=petrochenkov
Revert "remove `MethodReceiverExpr` special-casing"

This reverts commit 5ad560f7ec and adds a regression test.

Fixes rust-lang/rust#156084.

r? @petrochenkov
2026-05-05 14:25:24 +02:00
Jonathan Brouwer b503949164 Rollup merge of #156172 - ShoyuVanilla:slowbro, r=lcnr
Implement a new flag `-Zdisable-fast-paths` in trait solving

Discussion: [#t-types/trait-system-refactor > ask for help @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/364551-t-types.2Ftrait-system-refactor/topic/ask.20for.20help/near/583953725)

r? lcnr
2026-05-05 14:25:23 +02:00
Jonathan Brouwer 73e5912d1e Rollup merge of #156058 - qaijuang:issue-151393, r=JohnTitor
Print HRTB binders before fn qualifiers

Fixes rust-lang/rust#151393

This PR updates the custom fn-signature diff used in type mismatch diagnostics to print higher-ranked binders before fn qualifiers.

We might want to update reference also: https://github.com/rust-lang/reference/blob/581920f9109f141b88b860b3e1e8359e3896a150/src/items/external-blocks.md?plain=1#L60
2026-05-05 14:25:23 +02:00
Jonathan Brouwer e35334f6d4 Rollup merge of #156014 - petrochenkov:kvak, r=mu001999
resolve: Catch "cannot reexport" errors from macros 2.0 better

After the macro 2.0 related holes are closed we can report `span_delayed_bug`s in more situations.

Merging https://github.com/rust-lang/rust/pull/155945 would make changes in this PR simpler, but that PR will probably have to wait for quite some time.

This is a continuation of my import & privacy invariant hardening changes from https://github.com/rust-lang/rust/pull/155257, https://github.com/rust-lang/rust/pull/155213, https://github.com/rust-lang/rust/pull/154149, etc.

r? @mu001999
2026-05-05 14:25:22 +02:00
cyrgani ee350203e8 Revert "remove MethodReceiverExpr special-casing"
This reverts commit 5ad560f7ec and adds a regression test.
2026-05-05 10:56:28 +00:00
Shoyu Vanilla 4432f6bf82 Implement a new flag -Zdisable-fast-paths in trait solving 2026-05-05 19:46:30 +09:00
Daria Sukhonina 23cea556aa Remove duplicate debug assert 2026-05-05 12:39:51 +03:00
Oli Scherer a015eb119a Revert const hack and use const closure 2026-05-05 11:36:18 +02:00
Oli Scherer 664177fdf1 Remove const closure hacks in libstd 2026-05-05 11:35:29 +02:00
bors 4feb7221f4 Auto merge of #156166 - GuillaumeGomez:rollup-nfRhhYb, r=GuillaumeGomez
Rollup of 16 pull requests

Successful merges:

 - rust-lang/rust#155848 ([doc]: Revert `core::io::ErrorKind` doc changes)
 - rust-lang/rust#155855 (Remove unnecessary `get_unchecked`)
 - rust-lang/rust#155543 (docs(unstable-book): Document const generics features)
 - rust-lang/rust#155962 (`rustc`: `target_features`: allow for `cfg`-only stable `target_features`)
 - rust-lang/rust#156043 (c-variadic: gate `va_arg` on `c_variadic_experimental_arch`)
 - rust-lang/rust#156082 (Move tests associated types)
 - rust-lang/rust#156087 (Improve `&pin` reference-pattern suggestions)
 - rust-lang/rust#156092 (Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.)
 - rust-lang/rust#156103 (Fix E0040 suggestion for explicit `Drop::drop` UFCS calls)
 - rust-lang/rust#156104 (Relax `T: Sized` bound on `try_as_dyn` / `try_as_dyn_mut`)
 - rust-lang/rust#156122 (Add a `doc_cfg` regression test to ensure foreign types impls are working as expected)
 - rust-lang/rust#156128 (.mailmap: prefer matching just based on commit emails)
 - rust-lang/rust#156135 (Remove most uses of def_id_to_node_id)
 - rust-lang/rust#156152 (Update books)
 - rust-lang/rust#156154 (tests: mark import UI tests as check-pass)
 - rust-lang/rust#156162 (Update `browser-ui-test` version to `0.23.5`)
2026-05-05 07:17:39 +00:00
bors 83adf7e080 Auto merge of #155681 - bjorn3:update_dlmalloc, r=clubby789
Remove windows-sys from the library workspace

Windows-sys isn't actually used as dlmalloc doesn't use it on any of the targets where std uses dlmalloc, but still ends up in the lockfile and thus gets vendored. By using a patch to replace it with an empty crate the vendor size of the standard library is reduced from 93MB to 20MB.
2026-05-05 04:09:17 +00:00
mehdiakiki 9606b0bd77 Add rlib digest to identify Rust object files 2026-05-04 21:55:47 -04:00
Guillaume Gomez ba38fa0147 Rollup merge of #156162 - GuillaumeGomez:update-gui-tester, r=GuillaumeGomez
Update `browser-ui-test` version to `0.23.5`

This new version adds a small delay on page loads (with a timeout of 500ms) to give more time for some checks to work as expected.

r? ghost
2026-05-05 02:50:16 +02:00
Guillaume Gomez 7bf810e176 Rollup merge of #156154 - SynapLink:cleanup/check-pass-import-tests, r=folkertdev
tests: mark import UI tests as check-pass

These import and extern-prelude UI tests only exercise checking behavior, so they do not need codegen or linking.

Mark them as check-pass and remove the old FIXME(62277) markers.
2026-05-05 02:50:15 +02:00
Guillaume Gomez 6c3772206b Rollup merge of #156152 - rustbot:docs-update, r=ehuss
Update books

## rust-lang/reference

4 commits in 8c88f9d0bdd75ffdc0691676d83212ae22a18cee..581920f9109f141b88b860b3e1e8359e3896a150
2026-04-30 02:40:57 UTC to 2026-04-28 16:48:51 UTC

- Document trailing `self` in paths (rust-lang/reference#2237)
- add trailing comma (to follow style guidelines) (rust-lang/reference#2244)
- Doc: Add the LoongArch stabilized target features (rust-lang/reference#2217)
- typo (rust-lang/reference#2241)
2026-05-05 02:50:14 +02:00
Guillaume Gomez e4ed73e971 Rollup merge of #156135 - oli-obk:def_id_to_node_id_reduction, r=petrochenkov
Remove most uses of def_id_to_node_id

Especially those happening during normal resolving, where we are actually looking at current parent scopes. It allows follow-up refactorings to not have a way to go from `NodeId` to `DefId` until macro expansion is done

r? @petrochenkov
2026-05-05 02:50:14 +02:00
Guillaume Gomez 145df991c1 Rollup merge of #156128 - DanielEScherzer:gg-mailmap, r=GuillaumeGomez
.mailmap: prefer matching just based on commit emails

So that commits under different names are still caught
2026-05-05 02:50:13 +02:00
Guillaume Gomez 1e91ddd0c0 Rollup merge of #156122 - GuillaumeGomez:doc-cfg-test, r=Urgau
Add a `doc_cfg` regression test to ensure foreign types impls are working as expected

Fixes https://github.com/rust-lang/rust/issues/150268.

This is the last case mentioned in the issue that wasn't tested. With this, the issue can be closed.

r? @Urgau
2026-05-05 02:50:13 +02:00
Guillaume Gomez ca222b85ff Rollup merge of #156104 - aobatact:try-as-dyn-unsized, r=oli-obk
Relax `T: Sized` bound on `try_as_dyn` / `try_as_dyn_mut`

`trait_info_of` already returns `None` for unsized types, so allowing `T: ?Sized` is sound and lets callers in generic contexts use these functions without a separate `Sized` bound. For unsized `T`, the function always returns `None`.

Tracking issue: rust-lang/rust#144361

## Motivation

Currently, it is not possible to use `try_as_dyn` as "specialization-like" dispatch in
blanket impls with `?Sized` type.

```rust
// Cannot add ?Sized now.
impl<T: 'static /* + ?Sized */, S: Serializer + 'static> Serialize<S> for T {
    fn serialize(&self, serializer: &mut S) -> Result<S::Ok, S::Error> {
        if let Some(spec) = try_as_dyn::<_, dyn SpecializedSer<S>>(self) {
            spec.specialized_serialize(serializer)
        } else {
            // fall back to compile-time reflection via TypeId
            ...
        }
    }
}
```
2026-05-05 02:50:12 +02:00
Guillaume Gomez 20a4529124 Rollup merge of #156103 - Unique-Usman:ua/fixe0040, r=mejrs
Fix E0040 suggestion for explicit `Drop::drop` UFCS calls

`Drop::drop(&mut f)` now correctly suggests `drop(f)` instead of the bare `drop` with no argument.

Fix: rust-lang/rust#156017
2026-05-05 02:50:11 +02:00
Guillaume Gomez e4097f672e Rollup merge of #156092 - susitsm:needs-hir-hash, r=petrochenkov
Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.

While reviewing `crate_hash` query usage for https://github.com/rust-lang/rust/pull/155871, the `needs_crate_hash` function turned out to be the cause of unnecessary calls to the query. The `needs_crate_hash` name is easy to mistake for the functionality of "needs the crate_hash query". This PR removes the usage of `needs_crate_hash` where it was not appropriate and renames the function to `needs_hir_hash` which better reflects its functionality.
2026-05-05 02:50:11 +02:00
Guillaume Gomez 90cd3d3a96 Rollup merge of #156087 - P8L1:improve-pin-pattern-suggestions, r=Kivooeo
Improve `&pin` reference-pattern suggestions

This fills in the `pin_ergonomics` FIXME in `borrow_pat_suggestion` by making the diagnostic prefix account for both `Pinnedness` and `Mutability`.

Previously, the type-position suggestion path used ordinary reference spelling, which can spell `&` and `&mut` but cannot correctly spell pinned reference-pattern suggestions such as `&pin const` and `&pin mut`.

This is a diagnostic-only change. It adds focused UI coverage for both pinned const and pinned mut reference-pattern suggestions.
2026-05-05 02:50:10 +02:00
Guillaume Gomez 7a08b693d4 Rollup merge of #156082 - danieljofficial:move-tests-associated-types, r=petrochenkov
Move tests associated types

Hi, I have moved some ui tests I feel belong in the associated types folder
2026-05-05 02:50:09 +02:00
Guillaume Gomez be1e98b06e Rollup merge of #156043 - folkertdev:c-variadic-avr-assembly-test, r=joshtriplett
c-variadic: gate `va_arg` on `c_variadic_experimental_arch`

tracking issue: https://github.com/rust-lang/rust/issues/44930

Just gating `...` is insufficient because we make the types available everywhere, and you could still define and export functions that used va_arg for targets where we don't want to stably support it.

r? joshtriplett
2026-05-05 02:50:09 +02:00
Guillaume Gomez 8bf58ee5d4 Rollup merge of #155962 - romancardenas:cfg-only-stable-target-feature, r=RalfJung
`rustc`: `target_features`: allow for `cfg`-only stable `target_features`

This PR introduces a new stabilization level for `target_features`: `CfgOnlyStable`. The motivation is allowing the Rust compiler to expose `target_features` of targets so users can use `cfg(target_feature = "feature")` for conditional blocks depending on target features. However, `CfgOnlyStable` cannot be used for `#[target_feature(enable = "feature")]`, as this is still considered unstable. Accordingly, the compiler will still raise an error if these expressions are used on stable.

This PR relates partially to rust-lang/rust#150257. As discussed, for RISC-V targets, having the `"d"`, `"e"`, and `"f"` target features exposed will allow baremetal developers to adapt the code depending on the target's properties.

r? @RalfJung
2026-05-05 02:50:08 +02:00
Guillaume Gomez 594a848f49 Rollup merge of #155543 - popzxc:document-generic-const-features, r=BoxyUwU
docs(unstable-book): Document const generics features

Relevant tracking issues: rust-lang/rust#113521 rust-lang/rust#132980 rust-lang/rust#76560 rust-lang/rust#151972

## What

Adds a high-level overview of 4 unstable features related to const generic exprs.

## Why

While trying to learn about the current state of const generic exprs, I found it a bit too hard due to lack of documentation -- had to read through a bunch of tracking issues & look for PRs/examples in the repo just to understand what the feature is about.

Moreover, given that there is a bunch of features with similarly-looking names, it was even more confusing. For that purpose, I also added cross-referencing across (directly or logically) related features.

As a result, I decided to add some more context to the unstable book, so that new readers have an easier time than I had.

## Caveats

I understand that the features are incomplete/experimental, so the docs are at risk of becoming stale, but the book entrypoint already has [a corresponding warning](https://doc.rust-lang.org/unstable-book/), so I guess it should be fine.

Also, given that I did research myself, the examples provided might be not the best to showcase the feature -- happy to provide better examples, if you have suggestions. The examples provided are what "made the feature make sense" to me as an outsider, so there is a chance that they will be good for other external readers too, though.

LLM use disclosue: an LLM was used for self-review only; research, coming up with examples, and writing is mine. Issues reported by LLM were fixed manually too.

r? @BoxyUwU
2026-05-05 02:50:07 +02:00
Guillaume Gomez 6b750498bc Rollup merge of #155855 - ChrisDenton:remove-unsafe-get, r=Mark-Simulacrum
Remove unnecessary `get_unchecked`

My benchmarking did not show any issue with using the safe method instead so I assume this isn't an issue any more. But let's do a perf run to be sure.
2026-05-05 02:50:07 +02:00
Guillaume Gomez 6c103078ab Rollup merge of #155848 - bushrat011899:revert_08bd077, r=Mark-Simulacrum
[doc]: Revert `core::io::ErrorKind` doc changes

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/154654

## Description

rust-lang/rust#154654 changed the documentation for `ErrorKind` to remove links to `std` items. These changes were made falsely assuming documentation links from `core` to `std` were not possible. Since it is possible, we can restore the documentation to its original form prior to the `core::io` move.

## Notes

* No AI tooling of any kind was used in the creation of this PR.
2026-05-05 02:50:06 +02:00
Guillaume Gomez 7c44e45f14 Update browser-ui-test version to 0.23.5 2026-05-05 01:11:49 +02:00
Guillaume Gomez 45b9459637 Update askama version to 0.16.0 in clippy 2026-05-04 23:37:54 +02:00
Pieter-Louis Schoeman 14d414b7c8 Improve &pin reference-pattern suggestions
* Improve diagnostics for pinned reference patterns
* Gate pin pattern suggestion on pin ergonomics
* Document pin ergonomics suggestion gate
* Remove unnecessary incomplete_features allow

Co-authored-by: Redddy <midzy0228@gmail.com>
* Remove redundant incomplete_features allow

UI tests already allow incomplete_features by default, so the explicit allow is unnecessary.
* Update ref-pat-suggestions stderr

Bless line-number changes after removing the redundant incomplete_features allow.
* Simplify pinned ref pattern suggestion gating
* Fix formatting
* More formatting fixes
2026-05-04 20:24:08 +00:00
Usman Akinyemi e5b42e5084 Fix E0040 suggestion for explicit Drop::drop UFCS calls
`Drop::drop(&mut f)` now correctly suggests `drop(f)` instead of
the bare `drop` with no argument.

Signed-off-by: Usman Akinyemi <usmanakinyemi202@gmail.com>
2026-05-05 01:09:33 +05:30
SynapLink f9ddd9fdbb tests: mark import UI tests as check-pass 2026-05-04 19:38:47 +02:00
rustbot 5ace24b058 Update books 2026-05-04 19:01:25 +02:00
Vadim Petrochenkov fadb74734d rust-analyzer: Fix pub_use_of_private_extern_crate lint 2026-05-04 19:58:34 +03:00
Oli Scherer fd701b79a7 Remove most uses of def_id_to_node_id
Especially those happening during normal resolving, where we are actually looking at current parent scopes
2026-05-04 17:40:26 +02:00
Oli Scherer 71177d1b66 Add NodeId to ModuleKind 2026-05-04 17:40:26 +02:00
Román Cárdenas Rodríguez ee9a01aecf rustc: target_features: adapt compile errors and warnings for cfg-only stable features 2026-05-04 17:28:35 +02:00
bors cb40c25f6a Auto merge of #156139 - inq:minimize-reshell-perf, r=lcnr
Short-circuit `calculate_fallback_to_f32` when no float vars

Sharing a small fix.

When no unresolved variable is a `float_vid`, no f32 fallback can apply,
so we can skip `from_float_for_f32_root_vids` (which walks the proof tree
of every pending obligation under the new solver — O(N × M) on crates
with many large obligations).

On ReShell: stage1 wall-clock 2m35s → 1m46s (-49s, ~31%).

Context + profile breakdown will be linked at
rust-lang/trait-system-refactor-initiative#254 after this PR opens.

r? @lcnr
2026-05-04 14:02:18 +00:00
Vadim Petrochenkov 21c58d8ad9 resolve: Harden some invariant checks for visibilities 2026-05-04 15:51:36 +03:00
Vadim Petrochenkov 65e5bd6610 resolve: Catch "cannot reexport" errors from macros 2.0 better 2026-05-04 15:51:36 +03:00
Vadim Petrochenkov cf636ec649 resolve: Factor out reporting of "cannot reexport" errors into a separate function 2026-05-04 15:51:33 +03:00