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

record struct defined in function is invisible to type inference #5462

Closed
crumblingstatue opened this issue Jul 20, 2020 · 1 comment
Closed

Comments

@crumblingstatue
Copy link

fn main() {
    struct My {
        field: i32
    }

    let v = [My { field: 0 }];
}

image

If we move the definition of My above main, or make My a tuple or unit struct, type inference works.

rust-analyzer version: 2020-07-20 (c9c518e)

@lnicola
Copy link
Member

lnicola commented Jul 20, 2020

Duplicate of #1559.

@lnicola lnicola closed this as completed Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants