Recursive const stability checks do not apply in const items
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
All stable const fn in core/alloc/std are checked to ensure that they, transitively, do not use any unstable const features.
However, the same is not the case for const items. A stable fn can use array lengths, and a stable trait can have associated const, that use arbitrary unstable const features. That seems bad? I'm not entirely sure how to fix that though -- these items don't themselves have any stability, after all. They are just use in a large function (that may not even be a const fn).
One example where we are actually doing this is here:
https://github.com/rust-lang/rust/blob/7f74c894b0e31f370b5321d94f2ca2830e1d30fd/library/std/src/sys/pal/unix/process/process_unix.rs#L813
CMSG_SPACE is a const fn defined in libc. It is not subject to any recursive const stability checks.
Cc @rust-lang/wg-const-eval @compiler-errors
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by investigating the recursive const stability checks and the const item use in library/std/src/sys/pal/unix/process/process_unix.rs around CMSG_SPACE. Determine how const items and associated consts should be checked, then verify that unstable const features are rejected transitively in these cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100