racer
racer copied to clipboard
Feature Request: Determine Inferred Types Operation
Feature Request: Rust operation to infer and display the type of a variable or expression. Example
let foo = "blah";
Run this racer operation with source location at foo
, or "blah"
, Racer displays the name of the inferred type: &str
If I'm not mistaken, racer doesn't infer types except in the simplest cases (types evaluated from macros or pattern matching don't work, for example), so that needs to be improved in order to make this happen.
Is there a way to ask the rust compiler or one of its component libraries to do the type inference for us, that could be leveraged by racer?
It is the goal to eventually use rustc for type inference, and the rust tools team are working in the direction of making rustc more amenable for tools use, but it is a way off. I've been experimenting with using rustc for type inference, but it is an uphill battle with the current rustc design
On Wed, Aug 26, 2015 at 5:21 AM, Caleb Jones [email protected] wrote:
Is there a way to ask the rust compiler or one of its component libraries to do the type inference for us, that could be leveraged by racer?
— Reply to this email directly or view it on GitHub https://github.com/phildawes/racer/issues/304#issuecomment-134824739.
any update on this?
Would #728 address the specific request here for completions on &'static str
literal values? Also, #730 adds a get-type
command which should help for some of these cases.