rust-lang / rust-lang/rust-analyzer

`Implement missing members` generates without spaces between `*const` and `::` in type name.

Open
#11,526 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

// ::core::primitive::i32 is for example.
// these has no spaces between *const and ::core::primitive::i32 but pass `cargo check`.
trait A {
    fn a(a: *const::core::primitive::i32);
    fn b(a: *mut::core::primitive::i32);
    fn c(a: &mut::core::primitive::i32);
}

struct B;
impl A for B {}

After I writing this, Implement missing members generates impl A for B like this:

// these has no space between *const and core::primitive::i32 .
impl A for B {
    fn a(a: *constcore::primitive::i32) {
        todo!()
    }

    fn b(a: *mutcore::primitive::i32) {
        todo!()
    }

    fn c(a: &mutcore::primitive::i32) {
        todo!()
    }
}

rust-analyzer version: (eg. output of "Rust Analyzer: Show RA Version" command)
rust-analyzer version: 02904e99a 2022-02-14 stable

rustc version: (eg. output of rustc -V)
rustc 1.58.1 (db9d1b20b 2022-01-20)
rustc 1.60.0-nightly (e646f3d2a 2022-02-10)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTUP_HOME or CARGO_HOME)
CARGO, RUSTUP_HOME, CARGO_HOME: Not set.
Installed from rustup-init.exe

VSCode:
Version: 1.64.2 (system setup)
Commit: f80445acd5a3dadef24aa209168452a3d97cc326
Date: 2022-02-09T22:02:28.252Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043

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 at the “Implement missing members” assist entry point and reproduce the issue with the Rust trait example in the report. Inspect the generated signatures for raw pointers and references, then verify that the output separates the type keyword from the following path and remains accepted by cargo check.

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
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.