rust-lang / rust-lang/rust-analyzer

Tooltips on function names should not show `const fn` if using the fn in const would require a feature not active in the crate

Open
#15,972 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Screenshot 2023-11-26 13 03 44

Many stdlib functions, such as f32::from_be_bytes, are const fn only with a specific feature enabled.

The tooltip for the function's docs and info should not show the fn as being const fn if the required compiler feature isn't set within the crate.

rust-analyzer version: rust-analyzer version: 0.3.1740-standalone (255eed40c 2023-11-17)

rustc version: rustc 1.75.0-nightly (e5cfc5547 2023-10-28)

relevant settings: -

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

Begin at rust-analyzer's tooltip path for function documentation and info, then trace how constness and crate feature activation are determined. Check a standard-library function such as f32::from_be_bytes with the required feature disabled and enabled; done means the tooltip shows const fn only when the feature is active.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.