rust-lang / rust-lang/rust-analyzer

Filter const trait syntax and some unstable trait

Open
#23,066 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The Rust standard library has some unstable trait and const trait syntax

Although rustc_const_unstable can be handle correctly, r-a will output it when completing item-list

I want to implement it, but there are two problems:

  1. Which traits need to be removed itself instead of just removing [const]? Unstable and in the std::marker?
  2. When will it be disabled this? in configure? #![feature(const_trait_impl)]? Or something else?
struct Foo;
impl Iterator for Foo {
    fol$0
}

Current:

struct Foo;
impl Iterator for Foo {
    fn fold<B, F>(mut self, init: B, mut f: F) -> B
    where
        Self: Sized + [const] std::marker::Destruct,
        F: [const] FnMut(B, Self::Item) -> B + [const] std::marker::Destruct,
    {
        $0
    }
}

Expect:

struct Foo;
impl Iterator for Foo {
    fn fold<B, F>(mut self, init: B, mut f: F) -> B
    where
        Self: Sized,
        F: FnMut(B, Self::Item) -> B,
    {
        $0
    }
}

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 item-list completion for the provided Iterator implementation and inspect how rust-analyzer handles rustc_const_unstable and const trait syntax. Determine which unstable traits and [const] bounds should be omitted, and verify completion produces the expected fold signature without them.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.