Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
TethysSvensson opened this issue Mar 6, 2023 · 0 comments · Fixed by #14286
Closed

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

TethysSvensson opened this issue Mar 6, 2023 · 0 comments · Fixed by #14286
Assignees
Labels
C-bug Category: bug

Comments

@TethysSvensson
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants