rust-lang / rust-lang/rust-analyzer

`add_explicit_type` code action not available for `#[doc(hidden)]` types

Open
#17,934 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

rust-analyzer version: rust-analyzer version: 0.3.2078-standalone (fa0032624 2024-08-17)

rustc version: rustc 1.80.0 (051478957 2024-07-21)

editor or extension: Both Neovim and VSCode

code snippet to reproduce:

main.rs:

use ustr::UstrSet;

pub fn bar() -> UstrSet {
    todo!();
}

fn main() {
    let _i = 123;
    let foo = bar();
}

Cargo.toml:

[package]
name = "foo"
version = "0.1.0"
edition = "2021"

[dependencies]
ustr = "1.0.0"

When I try to perform the add_explicit_type code action on the variable i of a simple type the code action shows up just fine:

image

Whereas when I try to do the same thing on the variable foo that uses a type from an external crate (ustr in this case):

image

There's no code action available for inserting the type of foo.

Same behavior under VSCode.

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

Reproduce the issue using the main.rs and Cargo.toml snippets with ustr 1.0.0, comparing add_explicit_type for the local integer and the external UstrSet type. Trace the rust-analyzer implementation of this code action and verify that it becomes available for types marked #[doc(hidden)] while preserving the existing behavior for simple local types.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.