Skip to content

compiler: Temporarily re-export assert_matches! to reduce stabilization churn#151359

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Zalathar:assert-matches
Jan 19, 2026
Merged

compiler: Temporarily re-export assert_matches! to reduce stabilization churn#151359
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Zalathar:assert-matches

Conversation

@Zalathar
Copy link
Member

#137487 proposes to stabilize feature(assert_matches), while simultaneously moving the assert_matches! and debug_assert_matches! macros out of the std::assert_matches submodule and exporting them directly from the std crate root instead.

Unfortunately, that moving step would cause a lot of cfg(bootstrap) churn and noise in the compiler, because the compiler imports and uses those macros in dozens of places.

This PR therefore aims to reduce the overall compiler churn, by temporarily adjusting the compiler to always use assert_matches! via a re-export from rustc_data_structures. That way, the stabilization itself would only need to add cfg(bootstrap) to that single re-export (plus the associated #![feature(assert_matches)] attributes), greatly reducing the immediate impact on the compiler.

Once assert_matches! is stable in the stage0 bootstrap compiler, we can go back and delete the re-export, and adjust the rest of the compiler to import directly from std instead.

@rustbot
Copy link
Collaborator

rustbot commented Jan 19, 2026

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

Some changes occurred in match lowering

cc @Nadrieril

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

Some changes occurred to constck

cc @fee1-dead

HIR ty lowering was modified

cc @fmease

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in match checking

cc @Nadrieril

Some changes occurred to the core trait solver

cc @rust-lang/initiative-trait-system-refactor

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jan 19, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 19, 2026

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@Zalathar
Copy link
Member Author

Admittedly, making this change (and undoing it later) is its own form of churn.

But I think doing things this way is preferable to bundling all of the churn into the stabilization PR.

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@Noratrieb Noratrieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems like a good solution to ease the bootstrap bump

View changes since this review

@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 19, 2026

Having like 60 occurances of cfg(bootstrap) in the compiler for this indeed seems undesirable 😅 This will make the bootrstrap bump a lot nicer :)

r? me

@bors r=BoxyUwU,Noratrieb

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 19, 2026

📌 Commit 7ec34de has been approved by BoxyUwU,Noratrieb

It is now in the queue for this repository.

@rust-bors rust-bors bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jan 19, 2026
@rust-bors rust-bors bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 19, 2026
rust-bors bot pushed a commit that referenced this pull request Jan 19, 2026
…uwer

Rollup of 2 pull requests

Successful merges:

 - #151336 (Port rustc codegen attrs)
 - #151359 (compiler: Temporarily re-export `assert_matches!` to reduce stabilization churn)

r? @ghost
@rust-bors rust-bors bot merged commit 4004dd1 into rust-lang:main Jan 19, 2026
11 checks passed
rust-timer added a commit that referenced this pull request Jan 19, 2026
Rollup merge of #151359 - assert-matches, r=BoxyUwU,Noratrieb

compiler: Temporarily re-export `assert_matches!` to reduce stabilization churn

#137487 proposes to stabilize `feature(assert_matches)`, while simultaneously moving the `assert_matches!` and `debug_assert_matches!` macros out of the `std::assert_matches` submodule and exporting them directly from the `std` crate root instead.

Unfortunately, that moving step would cause a lot of `cfg(bootstrap)` churn and noise in the compiler, because the compiler imports and uses those macros in dozens of places.

This PR therefore aims to reduce the overall compiler churn, by temporarily adjusting the compiler to always use `assert_matches!` via a re-export from `rustc_data_structures`. That way, the stabilization itself would only need to add `cfg(bootstrap)` to that single re-export (plus the associated `#![feature(assert_matches)]` attributes), greatly reducing the immediate impact on the compiler.

Once `assert_matches!` is stable in the stage0 bootstrap compiler, we can go back and delete the re-export, and adjust the rest of the compiler to import directly from `std` instead.
@rustbot rustbot added this to the 1.95.0 milestone Jan 19, 2026
@Zalathar Zalathar deleted the assert-matches branch January 19, 2026 22:27
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-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants