External Publication
Visit Post

Type inference failure when accessing a value before its type is resolved

Rust Internals [Unofficial] May 10, 2026
Source

rxdiscovery:

This would be a welcome improvement.

Unfortunately the impact on compiler performance is unknown, and is likely to be large (unless someone will put a PR proving otherwise, of course). This likely will be rejected on that basis alone, given that the current state of things is not that bad.

rust-analyzer showing the type is because the type can be inferred at the end, and yes it's confusing, although I'm unsure how r-a could do better (displaying the type is definitely wanted, as it also impacts other IDE features such as inserting the type. Also, not displaying the type is quite difficult). This can even manifest in r-a errors (as "type Type does not have a method/field X", when it clearly has), and that is extra confusing and something we should fix.

Discussion in the ATmosphere

Loading comments...