Skip to content

autocomplete of const generic structures seems to be broken since 5/08/23 release #14926

Open
@kting28

Description

@kting28

rustc version: rustc 1.72.0-nightly (1c53407e8 2023-05-28)

This seems to be broken since rust analyzer v0.3.1514 , may be related to #14727 but I'm not sure.

I tried to narrow down the issue with simple structures featuring const generics but can't seem to trigger the bug without using the actual crate I'm developing. The crate itself is simple, just a lot of const generics usage:

cargo add spsc-ringbuf-core

use spsc_ringbuf_core::shared_pool::*;

const POOL_DEPTH: usize = 16;

pub struct Item {
    id: u32,
    payload: PoolIndex<POOL_DEPTH>,
}

impl HasPoolIdx<POOL_DEPTH> for Item {
    fn get_pool_idx(&self) -> PoolIndex<POOL_DEPTH> {
        self.payload
    }
    fn set_pool_idx(&mut self, pindex: PoolIndex<POOL_DEPTH>) {
        self.payload = pindex
    }
}

static SHARED_POOL: SharedPool<Item, Item, 16, 32> = SharedPool::new();

fn main() {

    SHARED_POOL.split();    //  dot autocomplete cannot find `split` or any other methods

}

dot autocompletion is broken:
image

However if I replace all references of POOL_DEPTH in the snippet above with a literal, e.g. 16, autocomplete works. In the earlier version (0.3.1506-standalone) the issue is not observed.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions