Skip to content

Rollup of 16 pull requests#156166

Open
GuillaumeGomez wants to merge 39 commits intorust-lang:mainfrom
GuillaumeGomez:rollup-nfRhhYb
Open

Rollup of 16 pull requests#156166
GuillaumeGomez wants to merge 39 commits intorust-lang:mainfrom
GuillaumeGomez:rollup-nfRhhYb

Conversation

@GuillaumeGomez
Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

popzxc and others added 30 commits April 20, 2026 18:13
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
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.
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.
…nabled, not when `needs_crate_hash` is true.

Exactly as the comment on the `crate_hash` field of `Linker` says, that
field is only used when incremental compilation is enabled.
`needs_crate_hash` returns true in some other cases too.
It's easy to confuse the functionality of `needs_crate_hash` with "is
the crate_hash query needed" right now. The function returns
whether we need to calculate the stable hash of various hir structs.
`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`.
So that commits under different names are still caught
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.
Especially those happening during normal resolving, where we are actually looking at current parent scopes
`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>
* 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
…rk-Simulacrum

[doc]: Revert `core::io::ErrorKind` doc changes

ACP: rust-lang/libs-team#755
Tracking issue: rust-lang#154046
Related: rust-lang#154654

## Description

rust-lang#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.
…ark-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.
…ures, r=BoxyUwU

docs(unstable-book): Document const generics features

Relevant tracking issues: rust-lang#113521 rust-lang#132980 rust-lang#76560 rust-lang#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
…et-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#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
…-test, r=joshtriplett

c-variadic: gate `va_arg` on `c_variadic_experimental_arch`

tracking issue: rust-lang#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
…ted-types, r=petrochenkov

Move tests associated types

Hi, I have moved some ui tests I feel belong in the associated types folder
…ns, 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.
…nkov

Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.

While reviewing `crate_hash` query usage for rust-lang#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.
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#156017
…-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#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
            ...
        }
    }
}
```
Add a `doc_cfg` regression test to ensure foreign types impls are working as expected

Fixes rust-lang#150268.

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

r? @Urgau
…laumeGomez

.mailmap: prefer matching just based on commit emails

So that commits under different names are still caught
…n, 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
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)
…t-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.
…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
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label May 5, 2026
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels May 5, 2026
@GuillaumeGomez
Copy link
Copy Markdown
Member Author

@bors r+ rollup=never p=5

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 5, 2026

📌 Commit ba38fa0 has been approved by GuillaumeGomez

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 5, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 5, 2026

⌛ Testing commit ba38fa0 with merge cc54c7e...

Workflow: https://github.com/rust-lang/rust/actions/runs/25351907365

rust-bors Bot pushed a commit that referenced this pull request May 5, 2026
Rollup of 16 pull requests

Successful merges:

 - #155848 ([doc]: Revert `core::io::ErrorKind` doc changes)
 - #155855 (Remove unnecessary `get_unchecked`)
 - #155543 (docs(unstable-book): Document const generics features)
 - #155962 (`rustc`: `target_features`: allow for `cfg`-only stable `target_features`)
 - #156043 (c-variadic: gate `va_arg` on `c_variadic_experimental_arch`)
 - #156082 (Move tests associated types)
 - #156087 (Improve `&pin` reference-pattern suggestions)
 - #156092 (Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.)
 - #156103 (Fix E0040 suggestion for explicit `Drop::drop` UFCS calls)
 - #156104 (Relax `T: Sized` bound on `try_as_dyn` / `try_as_dyn_mut`)
 - #156122 (Add a `doc_cfg` regression test to ensure foreign types impls are working as expected)
 - #156128 (.mailmap: prefer matching just based on commit emails)
 - #156135 (Remove most uses of def_id_to_node_id)
 - #156152 (Update books)
 - #156154 (tests: mark import UI tests as check-pass)
 - #156162 (Update `browser-ui-test` version to `0.23.5`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-meta Area: Issues & PRs about the rust-lang/rust repository itself rollup A PR which is a rollup S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.