rust-lang / rust-lang/rust

Document path stability of `f64::abs` in no std crates

Open
#139,066 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-docs A-stability C-enhancement T-libs T-rustdoc
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I tried this code:

#![no_std]

pub fn xxx() {
    f64::abs(1.0);
}

In Rust older than 1.84.

I expected to see this happen: successful compilation since f64::abs is documented to be available since Rust 1.0.

Instead, this happened: compilation failure since f64::abs in no std programs wasn't stabilized until Rust 1.84. This isn't documented anywhere and I had to go issue diving on GitHub.

@RalfJung said the keywords here are documenting path stability vs item stability.

https://github.com/rust-lang/rust/pull/131304#issuecomment-2760394373

Opening this issue to explore how to document the limited availability of items in no std programs.

In the absence of compiler infrastructure for this, free form text in the prose of the doc comment for the f64 primitive or its abs method would have solved this for me. Maybe in a # Caveats section?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the documentation for the f64 primitive and its abs method, along with the discussion in Rust PR 131304. Determine how the project should describe path stability versus item stability for no_std users; done means an agreed documentation approach that clearly explains the limited availability.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.