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

Destructure assist in function arguments doesn't respect nested structures #17525

Open
2ndDerivative opened this issue Jul 1, 2024 · 0 comments
Labels
A-assists A-completion autocompletion C-bug Category: bug

Comments

@2ndDerivative
Copy link

2ndDerivative commented Jul 1, 2024

I found this while working with nested function argument destructuring.

struct Outer<T>(T);
struct Inner {
    field: u32
}

fn stuff(Outer([...])) {
   ...
}

When typing "Inner" inside the Outer() brackets in fn stuff and accepting the assist for destructuring it will write this incorrect code:

fn stuff(Outer(Inner { field }: Inner))

instead of the correct

fn stuff(Outer(Inner { field }): Outer<Inner>)

I am not familiar with rust-analyzer's internals so I don't know how hard to fix it is but that's it.

@2ndDerivative 2ndDerivative added the C-bug Category: bug label Jul 1, 2024
@Veykril Veykril added A-completion autocompletion A-assists labels Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists A-completion autocompletion C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants