Suggest the correct name if using a struct literal and struct update syntax #105398
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=d00e87e77db94bfa1cc76d92b966c599
The current output is:
Ideally the output should look like:
You'd want to be somewhat conservative here, but in this case:
..blue_triangle
is aShape
Shape
For comparison with a similar construction in another language: TypeScript has a spread operator which is similar to Rust's struct update syntax, and it recognises that I'm overriding a field here without asking me to respecify the type. See TypeScript Playground example
The text was updated successfully, but these errors were encountered: