0
0
mirror of https://github.com/rust-lang/rust.git synced 2024-11-24 18:21:15 +01:00
rust/compiler/rustc_passes
Matthias Krüger 4a699fc475
Rollup merge of #132541 - RalfJung:const-stable-extern-crate, r=compiler-errors
Proper support for cross-crate recursive const stability checks

~~Stacked on top of https://github.com/rust-lang/rust/pull/132492; only the last three commits are new.~~

In a crate without `staged_api` but with `-Zforce-unstable-if-unmarked`, we now subject all functions marked with `#[rustc_const_stable_indirect]` to recursive const stability checks. We require an opt-in so that by default, a crate can be built with `-Zforce-unstable-if-unmarked` and use nightly features as usual. This property is recorded in the crate metadata so when a `staged_api` crate calls such a function, it sees the `#[rustc_const_stable_indirect]` and allows it to be exposed on stable. This, finally, will let us expose `const fn` from hashbrown on stable.

The second commit makes const stability more like regular stability: via `check_missing_const_stability`, we ensure that all publicly reachable functions have a const stability attribute -- both in  `staged_api` crates and `-Zforce-unstable-if-unmarked` crates. To achieve this, we move around the stability computation so that const stability is computed after regular stability is done. This lets us access the final result of the regular stability computation, which we use so that `const fn` can inherit the regular stability (but only if that is "unstable"). Fortunately, this lets us get rid of an `Option` in `ConstStability`.

This is the last PR that I have planned in this series.

r? `@compiler-errors`
2024-11-12 18:11:04 +01:00
..
src Rollup merge of #132541 - RalfJung:const-stable-extern-crate, r=compiler-errors 2024-11-12 18:11:04 +01:00
Cargo.toml compiler: Add rustc_abi dependence to the compiler 2024-10-27 21:10:58 -07:00
messages.ftl Auto merge of #127589 - notriddle:notriddle/search-sem-3, r=GuillaumeGomez 2024-11-11 12:26:00 +00:00