Show since when a function is const in stdlib#79548
Conversation
|
That was quick! |
|
|
||
| let const_ver = const_ver.and_then(|inner| if !inner.is_empty() { Some(inner) } else { None }); | ||
|
|
||
| if let Some(v) = ver { |
There was a problem hiding this comment.
No else because there shouldn't be such a thing as 'stably const but not stable'
| ); | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Can you assert here that const_ver.is_none(), and add an error earlier (in from_def_id_and_parts, since that's the only place const_stability isn't None) if const_stability is set but not stability? If you're feeling really ambitious, you could make it part of the type system in Item and have stability: Option(Stability, Option<ConstStability>).
|
@bors r+ After thinking about this more, I realized that ' |
|
📌 Commit ccbb0f5 has been approved by |
|
Opened #79551 to address the rustc side |
Show since when a function is const in stdlib Fixes rust-lang#76998 This makes it so that functions with the `#[rustc_const_stable()]` attribute now show from what version they were stably declared const, alongside what version they were declared stable. Example from `Result`:  r? `@jyn514`
Rollup of 11 pull requests Successful merges: - rust-lang#79038 (Change ui test that are run-pass and that do not test the compiler to library tests) - rust-lang#79184 (Stop adding '*' at the end of slice and str typenames for MSVC case) - rust-lang#79227 (Remove const_fn_feature_flags test) - rust-lang#79444 (Move const ip in ui test to unit test) - rust-lang#79522 (Validate lint docs separately.) - rust-lang#79525 (Add -Z normalize-docs and enable it for compiler docs) - rust-lang#79527 (Move intra-doc link tests into a subdirectory) - rust-lang#79548 (Show since when a function is const in stdlib) - rust-lang#79568 (update Miri) - rust-lang#79573 (Update with status for various NetBSD ports.) - rust-lang#79583 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes #76998
This makes it so that functions with the

#[rustc_const_stable()]attribute now show from what version they were stably declared const, alongside what version they were declared stable. Example fromResult:r? @jyn514