Skip to content

Rollup of 11 pull requests #144952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 25 commits into
base: master
Choose a base branch
from

Conversation

samueltardieu
Copy link
Member

@samueltardieu samueltardieu commented Aug 5, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

try-job: test-various

Create a similar rollup

oli-obk and others added 25 commits July 21, 2025 09:11
Co-authored-by: Tshepang Mbambo <[email protected]>
Currently the Args new function is scope constrained to pub(super) but this stops me from being able to construct Args structs in unit tests.
The current `rust-version = "1.63"` was inherited from rayon, but it
doesn't make sense to limit this in the compiler workspace. Having any
setting at all has effects on tools like `cargo info` that try to infer
the MSRV when the workspace itself doesn't specify it. Since we are the
compiler, our only MSRV is whatever bootstrapping requires.
…zelmann

Port #[macro_export] to the new attribute parsing infrastructure

Ports macro_export to the new attribute parsing infrastructure for rust-lang#131229 (comment)

r? `````@oli-obk`````

cc `````@JonathanBrouwer````` `````@jdonszelmann`````
…=lcnr

Stabilize const TypeId::of

fixes rust-lang#77125

# Stabilization report for `const_type_id`

## General design

### What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized?

N/A the constness was never RFCed

### What behavior are we committing to that has been controversial? Summarize the major arguments pro/con.

`const_type_id` was kept unstable because we are currently unable to stabilize the `PartialEq` impl for it (in const contexts), so we feared people would transmute the type id to an integer and compare that integer.

### Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those?

`TypeId::eq` is not const at this time, and will only become const once const traits are stable.

## Has a Call for Testing period been conducted? If so, what feedback was received?

This feature has been unstable for a long time, and most people just worked around it on stable by storing a pointer to `TypeId::of` and calling that at "runtime" (usually LLVM devirtualized the function pointer and inlined the call so there was no real performance difference).

A lot of people seem to be using the `const_type_id` feature gate (600 results for the feature gate on github: https://github.com/search?q=%22%23%21%5Bfeature%28const_type_id%29%5D%22&type=code)

We have had very little feedback except desire for stabilization being expressed.

## Implementation quality

Until these three PRs

* rust-lang#142789
* rust-lang#143696
* rust-lang#143736

there was no difference between the const eval feature and the runtime feature except that we prevented you from using `TypeId::of` at compile-time. These three recent PRs have hardened the internals of `TypeId`:

* it now contains an array of pointers instead of integers
* these pointers at compile-time (and in miri) contain provenance that makes them unique and prevents inspection. Both miri and CTFE will in fact error if you mess with the bits or the provenance of the pointers in any way and then try to use the `TypeId` for an equality check. This also guards against creating values of type `TypeId` by any means other than `TypeId::of`

### Summarize the major parts of the implementation and provide links into the code (or to PRs)

N/A see above

### Summarize existing test coverage of this feature

Since we are not stabilizing any operations on `TypeId` except for creating `TypeId`s, the test coverage of the runtime implementation of `TypeId` covers all the interesting use cases not in the list below

#### Hardening against transmutes

* https://github.com/rust-lang/rust/blob/master/tests/ui/consts/const_transmute_type_id.rs
* https://github.com/rust-lang/rust/blob/master/tests/ui/consts/const_transmute_type_id2.rs
* https://github.com/rust-lang/rust/blob/master/tests/ui/consts/const_transmute_type_id3.rs
* https://github.com/rust-lang/rust/blob/master/tests/ui/consts/const_transmute_type_id4.rs
* https://github.com/rust-lang/rust/blob/master/tests/ui/consts/const_transmute_type_id5.rs

#### TypeId::eq is still unstable

* https://github.com/rust-lang/rust/blob/master/tests/ui/consts/const_cmp_type_id.rs

### What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking?

rust-lang#129014 is still unresolved, but it affects more the runtime version of `TypeId` than the compile-time.

### What FIXMEs are still in the code for that feature and why is it ok to leave them there?

none

### Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization

* `````@eddyb`````
* `````@RalfJung`````

### Which tools need to be adjusted to support this feature. Has this work been done?

N/A

## Type system and execution rules

### What compilation-time checks are done that are needed to prevent undefined behavior?

Already covered above. Transmuting types with private fields to expose those fields has always been library UB, but for the specific case of `TypeId` CTFE and Miri will detect it if that is done in any way other than for reconstructing the exact same `TypeId` in another ___location.

### Does the feature's implementation need checks to prevent UB or is it sound by default and needs opt in in places to perform the dangerous/unsafe operations? If it is not sound by default, what is the rationale?

N/A

### Can users use this feature to introduce undefined behavior, or use this feature to break the abstraction of Rust and expose the underlying assembly-level implementation? (Describe.)

N/A

### What updates are needed to the reference/specification? (link to PRs when they exist)

Nothing more than what needs to exist for `TypeId` already.

## Common interactions

### Does this feature introduce new expressions and can they produce temporaries? What are the lifetimes of those temporaries?

N/A

### What other unstable features may be exposed by this feature?

N/A
…oxyUwU

Add documentation for unstable_feature_bound

There is more detail and explanation in https://hackmd.io/``@tiif/Byd3mq7Ige``

Original PR that implemented this: rust-lang#140399

r? ``@BoxyUwU`` to nominate for types team discussion
…k-Simulacrum

Stabilize `strict_overflow_ops`

Closes rust-lang#118260
…er, r=WaffleLapkin

Anonymize binders in tail call sig

See the comment for explanation

Fixes rust-lang#144826

r? WaffleLapkin
Change visibility of Args new function

Currently the Args new function is constrained to pub(super) but this stops me from being able to construct Args structs in unit tests.

This pull request is to change this to pub.
…lize, r=dtolnay

Stabilize `unsigned_signed_diff` feature

This closes [tracking issue](rust-lang#126041) and stabilises `checked_signed_diff`

r? libs-api
…ifetimes, r=lcnr

Enforce tail call type is related to body return type in borrowck

Like all call terminators, tail call terminators instantiate the binder of the callee signature with region variables and equate the arg operand types with that signature's args to ensure that the call is valid.

However, unlike normal call terminators, we were forgetting to also relate the return type of the call terminator to anything. In the case of tail call terminators, the correct thing is to relate it to the return type of the caller function (or in other words, the return local `_0`).

This meant that if the caller's return type had some lifetime constraint, then that constraint wouldn't flow through the signature and affect the args.

This is what's happening in the example test I committed:

```rust
fn link(x: &str) -> &'static str {
    become passthrough(x);
}

fn passthrough<T>(t: T) -> T { t }

fn main() {
    let x = String::from("hello, world");
    let s = link(&x);
    drop(x);
    println!("{s}");
}
```

Specifically, the type `x` is `'?0 str`, where `'?0` is some *universal* arg. The type of `passthrough` is `fn(&'?1 str) -> &'?1 str`. Equating the args sets `'?0 = '?1`. However, we need to also equate the return type `&'?1 str` to `&'static str` so that we eventually require that `'?0 = 'static`, which is a borrowck error!

-----

Look at the first commit for the functional change, and the second commit is just a refactor because we don't need to pass `Option<BasicBlock>` to `check_call_dest`, but just whether or not the terminator is expected to be diverging (i.e. if the return type is `!`).

Fixes rust-lang#144916
…iper

Correct the use of `must_use` on btree::IterMut

I'm working on stricter target checking for attributes and found this one
Drop `rust-version` from `rustc_thread_pool`

The current `rust-version = "1.63"` was inherited from rayon, but it
doesn't make sense to limit this in the compiler workspace. Having any
setting at all has effects on tools like `cargo info` that try to infer
the MSRV when the workspace itself doesn't specify it. Since we are the
compiler, our only MSRV is whatever bootstrapping requires.
…eLapkin

Autolabel PRs that change explicit tail call tests as `F-explicit_tail_calls`

mrrrow~
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-rustc-dev-guide Area: rustc-dev-guide A-rustdoc-json Area: Rustdoc JSON backend S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 5, 2025
bors added a commit that referenced this pull request Aug 5, 2025
Rollup of 11 pull requests

Successful merges:

 - #143857 (Port #[macro_export] to the new attribute parsing infrastructure)
 - #144133 (Stabilize const TypeId::of)
 - #144676 (Add documentation for unstable_feature_bound)
 - #144682 (Stabilize `strict_overflow_ops`)
 - #144835 (Anonymize binders in tail call sig)
 - #144836 (Change visibility of Args new function)
 - #144900 (Stabilize `unsigned_signed_diff` feature)
 - #144917 (Enforce tail call type is related to body return type in borrowck)
 - #144926 (Correct the use of `must_use` on btree::IterMut)
 - #144928 (Drop `rust-version` from `rustc_thread_pool`)
 - #144945 (Autolabel PRs that change explicit tail call tests as `F-explicit_tail_calls`)

r? `@ghost`
`@rustbot` modify labels: rollup
@jieyouxu
Copy link
Member

jieyouxu commented Aug 5, 2025

@/bors treeclosed=1000

@jieyouxu
Copy link
Member

jieyouxu commented Aug 5, 2025

@bors retry r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 5, 2025
@samueltardieu
Copy link
Member Author

Looks like "retry r-" is understood as "r-" and got the PR kicked out of the queue. I'll just "retry" it (hope I'm not contradicting something you did on purpose).

@bors retry

@bors bors 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 5, 2025
@samueltardieu
Copy link
Member Author

Retry didn't do anything apparently. Let's try r+ then.

@bors r+

@bors
Copy link
Collaborator

bors commented Aug 5, 2025

📌 Commit 44030ec has been approved by samueltardieu

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Aug 5, 2025

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@samueltardieu
Copy link
Member Author

samueltardieu commented Aug 5, 2025

@/bors treeclosed-

bors added a commit that referenced this pull request Aug 5, 2025
Rollup of 11 pull requests

Successful merges:

 - #143857 (Port #[macro_export] to the new attribute parsing infrastructure)
 - #144133 (Stabilize const TypeId::of)
 - #144676 (Add documentation for unstable_feature_bound)
 - #144682 (Stabilize `strict_overflow_ops`)
 - #144835 (Anonymize binders in tail call sig)
 - #144836 (Change visibility of Args new function)
 - #144900 (Stabilize `unsigned_signed_diff` feature)
 - #144917 (Enforce tail call type is related to body return type in borrowck)
 - #144926 (Correct the use of `must_use` on btree::IterMut)
 - #144928 (Drop `rust-version` from `rustc_thread_pool`)
 - #144945 (Autolabel PRs that change explicit tail call tests as `F-explicit_tail_calls`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Collaborator

bors commented Aug 5, 2025

⌛ Testing commit 44030ec with merge 77f529b...

@rust-log-analyzer
Copy link
Collaborator

The job test-various failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
   Doc-tests core
Error: WebAssembly translation error

Caused by:
    Invalid input WebAssembly code at offset 1178366: too many locals: locals exceed maximum
WARNING: No rustdoc doctest environment variable provided so doctests will be run in the same process

running 2 tests
test library/core/src/primitive_docs.rs - prim_array (line 735) ... ok
test library/core/src/primitive_docs.rs - prim_array (line 792) ... ok

@bors
Copy link
Collaborator

bors commented Aug 5, 2025

💔 Test failed - checks-actions

@bors bors 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 Aug 5, 2025
@samueltardieu
Copy link
Member Author

@bors try

@rust-bors
Copy link

rust-bors bot commented Aug 5, 2025

⌛ Trying commit 44030ec with merge 4e0f8c3

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Aug 5, 2025
Rollup of 11 pull requests

try-job: test-various
@samueltardieu
Copy link
Member Author

@bors2 try jobs=test-various
(I'll cancel the bors job afterwards if this one starts)

@rust-bors
Copy link

rust-bors bot commented Aug 5, 2025

⌛ Trying commit 44030ec with merge 920b74e

(The previously running try build was automatically cancelled.)

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Aug 5, 2025
Rollup of 11 pull requests

try-job: test-various
@samueltardieu
Copy link
Member Author

@bors try cancel

@rust-bors
Copy link

rust-bors bot commented Aug 5, 2025

Try build cancelled. Cancelled workflows:

@samueltardieu
Copy link
Member Author

Ah ah, that cancelled both
@bors2 try jobs=test-various

@rust-bors
Copy link

rust-bors bot commented Aug 5, 2025

⌛ Trying commit 44030ec with merge 0ec62b4

To cancel the try build, run the command @bors try cancel.

rust-bors bot added a commit that referenced this pull request Aug 5, 2025
Rollup of 11 pull requests

try-job: test-various
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-rustc-dev-guide Area: rustc-dev-guide A-rustdoc-json Area: Rustdoc JSON backend rollup A PR which is a rollup S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. 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.