Skip to content

Missing completions for items defined inside a const _: () = { ... } block #14263

Closed
@TethysSvensson

Description

@TethysSvensson

rust-analyzer version: rust-analyzer 0.3.1426-standalone

rustc version: rustc 1.67.1 (d5a82bbd2 2023-02-07)

I have run into some missing completions with bitflags v2.0.0-rc.3. I have managed to make a minimal reproducer:

pub struct T;

macro_rules! m {
    ($name:ident) => {
        impl T {
            pub const $name: u32 = 0;
        }
    };
}

const _: () = {
    m! { FIELD }
};

fn f() {
    let _ = T::[PUT_CURSOR_HERE];
}

If you put your cursor inside the f function, you should be able to do a completion on T::FIELD, however that completion does not show up.

The completion works as expected if you change m! { FIELD } to m!(FIELD); or if you inline the definition.

Metadata

Metadata

Assignees

Labels

C-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions