How do you work with rust?


I’m working on getting into rust. I have both Intellij and Rusty Code up and working. However, I find that they struggle too much with type deduction. A simple thing like

let bob = vec![1,2,3,4];

fails with both to give any suggestions that are worthwhile (am I just setup wrong?)

I can write code like this

let bob : Vec<_> = vec![1,2,3,4];

And that does get some type help. However, if I take it just a step further to

let bob : Vec<_> = vec![1,2,3,4];

it stops working again.

So I’m left wondering “Am I doing it wrong?”. I come from a java background and rely really heavily on my IDE. However, is that not the right workflow for rust? Should I instead have the docs open up at all times and rely on that and compiling instead?

Also, what is everyone else doing for debugging? Print statements? Manual GDB wrangling? unit tests?

Any tips and pointers or just a discussion of what your current workflow is would be helpful to me.


For the IntelliJ Rust, I can say that this is the state of the art at the moment unfortunately :frowning: We don’t handle type inference with generics and macros yet (though generics are coming).

Providing a good IDE story for the language is a lot of work, the current state is rather poor, but things are improving steadily :slight_smile:


I don’t know, if it works better, but did you try Visual Studio Code with the rust plugin?


One thing I like about my Rust endeavours so far is that it (and a few other new languages too) taught me not to rely on and care about IDE support too much. It’s been a liberating experience.


Often times I wonder why people, who heavily use vimscript or elisp, and who are excited about text objects or paredit, just don’t pursue the idea of having parse tree, name resolution and type information available for scripting in their favorite editor :slight_smile:


I want these things, but I want Ctrl+Z and 2dw more.


I actually think emacs with racer make for a decent development experience, but it’s true that racer it far from being at the level IDEA or Visual Studio is for their native languages - still, it’s the best we have right now.

If you’re looking for an easy to set up Rust “IDE”, try with the tokamak plugin, it has every Rust tool integrated into one package.


Latest Geany (available for Linux and MacOS) has a good Rust plugin. It isn’t going to be a fancy experience, but it’s surprisingly competent and fast. I’ve found the rust-gdb that comes with Rustup does a good job - still haven’t found out how to integrate it with the Geany Debugger plugin.


We’re still working on our IDE integration stuff very actively; we care about this use-case, but it’s taken some time to get going.

I personally use vim without anything fancy, and use unit tests -> print statements -> gdb (in that order, for debugging).


I’ve been using atom with a few extensions. The main packages I’m using are language-rust, racer, build-cargo and their needed dependencies. It was fairly quick to set up, works well but in the end isn’t a real IDE environment. Racer often fails to provide correct autocomplete suggestions. Having type interference support in the IDE is something I really miss from scala+intellij. Right now when I want to know what type the compiler has inferred I move the value into “let x: u32” and look at the error message. It isn’t a great workaround but it works for now.


This is a great hint for novice users. Thanks!


Slightly shorter:

let () = value;



Did you try youcompleteme for vim? I am using it with the racer integration and it works pretty good so far.


I don’t personally use code completion.


I’m using the Eclipse Plugin.
But I’ve getting used to notepad++ on my host, editing the shared sources on my test VM. But it took me also a white to get away from eclipse, after using it everyday from java to c.
And yeah, having open the docs is quite normal for me. (Also having implemented the doc search into my browser is quite nice.)


Even if you’re not interested in code completion, part of YCM is an identifier-based completion engine which is useful for preventing typos related to variable/method names and saving key strokes. Code completion is nice too for similar reasons.

Code completion aside, the GoTo support is actually very good and seriously improved my ability to dig into random libraries. Jumping straight to the implementation of some method you’re puzzled about is really powerful.


I totally agree, just the typing speed improvement is it worth.


It’s worth mentioning there’s a website providing a summary of the state of IDEs in the Rust ecosystem, whether it be plugins for existing editors/IDEs or actual IDEs built with Rust in mind.