Skip to content
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

macro call site go to definition #17032

Closed
xbz-24 opened this issue Apr 8, 2024 · 9 comments
Closed

macro call site go to definition #17032

xbz-24 opened this issue Apr 8, 2024 · 9 comments
Labels
A-nameres name, path and module resolution C-bug Category: bug

Comments

@xbz-24
Copy link

xbz-24 commented Apr 8, 2024

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)

rustc version: (eg. output of rustc -V)

editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

// add your code here

image

image

mod cs {
        vulkano_shaders::shader! {
            ty: "compute",
            src: r"
            #version 460

            layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;

            layout(set = 0, binding = 0, rgba8) uniform writeonly image2D img;

            void main() {
                vec2 norm_coordinates = (gl_GlobalInvocationID.xy + vec2(0.5)) / vec2(imageSize(img));
                vec2 c = (norm_coordinates - vec2(0.5)) * 2.0 - vec2(1.0, 0.0);

                vec2 z = vec2(0.0, 0.0);
                float i;
                for (i = 0.0; i < 1.0; i += 0.005) {
                    z = vec2(
                        z.x * z.x - z.y * z.y + c.x,
                        z.y * z.x + z.x * z.y + c.y
                    );

                    if (length(z) > 4.0) {
                        break;
                    }
                }

                vec4 to_write = vec4(vec3(i), 1.0);
                imageStore(img, ivec2(gl_GlobalInvocationID.xy), to_write);
            }
            ",
        }
    }

    let shader = cs::load(device.clone()).expect("failed to create shader module")

would be useful that go to definition takes you to the call site of the macro, right now this tells very little of the inner workings or what is going really right now.

image

image

Please let me know if someone cares about implementing this.

@xbz-24 xbz-24 added the C-bug Category: bug label Apr 8, 2024
@Veykril
Copy link
Member

Veykril commented Apr 8, 2024

What rust-analyzer version are you on? (There is a reason for the issue template existing, so it'd be nice if you filled that out...)

@xbz-24
Copy link
Author

xbz-24 commented Apr 8, 2024

rust-analyzer --version
rust-analyzer 1.77.1 (7cf61ebd 2024-03-27)

this is the rust-analyzer's version, please let me know if there is a fix to this or not @Veykril

@xbz-24
Copy link
Author

xbz-24 commented Apr 8, 2024

image

@xbz-24
Copy link
Author

xbz-24 commented Apr 8, 2024

this is the rust-analyzer version vscode is using

@xbz-24
Copy link
Author

xbz-24 commented Apr 8, 2024

rustc -V
rustc 1.77.1 (7cf61ebde 2024-03-27)

@xbz-24
Copy link
Author

xbz-24 commented Apr 8, 2024

image

@Veykril
Copy link
Member

Veykril commented Apr 8, 2024

Looks like we fail to resolve the extern prelude in local modules in block modules, it works fine if the mod cs is at the top-level (not nested inside a function or anything)

fn main() {
    mod f {
        use core as _;
    }
}

here core does not resolve

@Veykril Veykril added the A-nameres name, path and module resolution label Apr 8, 2024
@xbz-24
Copy link
Author

xbz-24 commented Apr 8, 2024

can someone fix this shit? it also happens with local modules when its outside of main

@rust-lang rust-lang locked as too heated and limited conversation to collaborators Apr 8, 2024
@lnicola
Copy link
Member

lnicola commented May 27, 2024

Probably fixed in #17251.

@lnicola lnicola closed this as completed May 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-nameres name, path and module resolution C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants