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

Rust-analyzer or VS code error #7458

Closed
dickytamara opened this issue Jan 27, 2021 · 5 comments · Fixed by #7465
Closed

Rust-analyzer or VS code error #7458

dickytamara opened this issue Jan 27, 2021 · 5 comments · Fixed by #7465
Labels
S-actionable Someone could pick this issue up and work on it right now

Comments

@dickytamara
Copy link

I have code like this

pub const fn test(a: i32, b: i32) -> [i32; 2] { [a, b] }

const LOOKUPVALUE: &'static [[i32;2]; 4] = &[
    test(0x0fab272b, 0x0fab272b), test(0x7e1d93ea, 0x7e1d93ea),
    test(0x0fab272b, 0x7e1d93ea), test(0x7e1d93ea, 0x0fab272b),
];

fn main() {
    //
    LOOKUPVALUE.iter().for_each(|x| println!("{:?}", x))

}

Vs-code
Screenshot from 2021-01-27 06-53-23

please look at variable that printed on const LOOKUPVALUE "a:" and "b:"

@bjorn3
Copy link
Member

bjorn3 commented Jan 27, 2021

Duplicate of #7434

@bjorn3 bjorn3 marked this as a duplicate of #7434 Jan 27, 2021
@bjorn3 bjorn3 closed this as completed Jan 27, 2021
@flodiebold flodiebold reopened this Jan 27, 2021
@flodiebold
Copy link
Member

flodiebold commented Jan 27, 2021

I don't think this is related to #7434. (That issue is about const parameters, not bodies of const items, which we do already handle.)

The issue is a bit unclear, but I think what @dickytamara is referring to is that the parameter hints a: and b: only show up in some of the calls. My guess is that our heuristics are a bit too eager there; notice that the arguments where the hints are hidden end in a resp. b.

@flodiebold flodiebold added the S-actionable Someone could pick this issue up and work on it right now label Jan 27, 2021
@bjorn3 bjorn3 marked this as not a duplicate of #7434 Jan 27, 2021
@dickytamara
Copy link
Author

here another example, like @flodiebold says heruistic more resonable for now
Screenshot from 2021-01-27 17-05-23

@Veykril
Copy link
Member

Veykril commented Jan 27, 2021

The problem is that we check if the expression has the argument name as a prefix or postfix and since your hexadecimal numbers have a trailing a or b the parameter hints disappear respectively. We shouldn't just check every expression like that but only some of them, mainly field access, paths and method_calls I guess?

@dickytamara
Copy link
Author

yes @Veykril , hints disappear when we have same postfix. i found this when editing large set of predefined table value.

@bors bors bot closed this as completed in c76cab6 Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants