Skip to content

Rollup of 6 pull requests#156140

Closed
jhpratt wants to merge 17 commits intorust-lang:mainfrom
jhpratt:rollup-tW55BUD
Closed

Rollup of 6 pull requests#156140
jhpratt wants to merge 17 commits intorust-lang:mainfrom
jhpratt:rollup-tW55BUD

Conversation

@jhpratt
Copy link
Copy Markdown
Member

@jhpratt jhpratt commented May 4, 2026

Successful merges:

r? @ghost

Create a similar rollup

popzxc and others added 17 commits April 20, 2026 18:13
Co-authored-by: León Orell Valerian Liehr <me@fmease.dev>
…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.
…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
…-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
…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.
…-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
            ...
        }
    }
}
```
…laumeGomez

.mailmap: prefer matching just based on commit emails

So that commits under different names are still caught
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label May 4, 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. labels May 4, 2026
@jhpratt
Copy link
Copy Markdown
Member Author

jhpratt commented May 4, 2026

@bors r+ rollup=never p=5

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 4, 2026

📌 Commit 561cac7 has been approved by jhpratt

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 4, 2026
@rust-bors

This comment has been minimized.

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

Successful merges:

 - #155543 (docs(unstable-book): Document const generics features)
 - #156043 (c-variadic: gate `va_arg` on `c_variadic_experimental_arch`)
 - #156082 (Move tests associated types)
 - #156092 (Clean up `TyCtxt::needs_crate_hash` usage and rename it to `needs_hir_hash`.)
 - #156104 (Relax `T: Sized` bound on `try_as_dyn` / `try_as_dyn_mut`)
 - #156128 (.mailmap: prefer matching just based on commit emails)
@rust-log-analyzer
Copy link
Copy Markdown
Collaborator

The job x86_64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test expr_store::scope::tests::test_shadow_variable ... ok
test expr_store::scope::tests::test_resolve_local_name ... ok
test expr_store::tests::body::array_element_cfg ... ok
test expr_store::scope::tests::while_let_adds_binding ... ok
error: test failed, to rerun pass `-p hir-def --lib`

Caused by:
  process didn't exit successfully: `/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/deps/hir_def-c439368f2b64a049 '--skip=tests::smoke_test_real_sysroot_cargo' --skip=check_code_formatting -Z unstable-options --format json` (signal: 11, SIGSEGV: invalid memory reference)
Bootstrap failed while executing `--stage 2 test --skip tests --skip coverage-map --skip coverage-run --skip library --skip tidyselftest`
Build completed unsuccessfully in 1:10:34
  local time: Mon May  4 14:00:56 UTC 2026
  network time: Mon, 04 May 2026 14:00:57 GMT
##[error]Process completed with exit code 1.

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

rust-bors Bot commented May 4, 2026

💔 Test for 2c0b32a failed: CI. Failed job:

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

Spurious

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 4, 2026
@rust-bors rust-bors Bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 4, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 4, 2026

This pull request was unapproved due to being closed.

@jhpratt jhpratt deleted the rollup-tW55BUD branch May 4, 2026 20:40
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-author Status: This is awaiting some action (such as code changes or more information) from the author. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants