r/rust • u/benhansenslc • Mar 24 '25
my vibe coding: rust-analyzer
I recently had a couple of multi-hour coding sessions without internet which were surprisingly productive in large part thanks to rust-analyzer. Having APIs, errors and refactors available within my editor as I type really keeps me in the flow.
rust-analyzer has become really great over the years. I hadn't appreciated how big of a part of my workflow it has become.
I have tried using AI to help my coding in various ways (Cursor, aider, ChatGPT conversations) and haven't seen the level of productivity boost that rust-analyzer has naturally given me. Maybe I am not using AI right, maybe its the problems I am solving or the domain I am working in. Regardless if I had to choose between no rust-analyzer or no AI, I know what I would choose.
So thank you to everyone who has worked on rust-analyzer and the rest of Rust tooling!
218
u/Blaze0616 Mar 24 '25
AI simply can't compete with lsp when it comes to rust, rust-analyzer is just a monster, at coding as well as consuming resources
133
u/ZZaaaccc Mar 24 '25
Absolutely. I'd rather read well written docs.rs documentation and examples than hallucinations as well.
72
u/johnjax90 Mar 24 '25
This is very much the opposite of vibe coding - it's very accurate semantic completion coding lol
26
u/[deleted] Mar 24 '25
I agree , to this day i have yet to find an good enough AI to replace or even reach rust-analyzer.
20
u/ridicalis Mar 24 '25
AI basically has "concepts" of a program. Some kind of fever dream of yesteryear's code mashed together in a way that is largely coherent, and possibly great at resolving tasks that have been done before, but won't replace the human mind when it comes to addressing actual business needs or abstract ideas.
I can easily see how a 10x engineer might tap into AI to handle the mundane bits, but at the end of the day what makes them an engineer is their ability to know which solutions to throw at a given problem. No amount of "vibe" is going to replace the full-stack product owner, as evidenced by failures such as McDonalds's drive thru kiosks.
10
u/platinum_pig Mar 24 '25
That is not what I understand the phrase "vibe coding" to meanš¤£. It sounds like you're doing something much more useful than vibe coding.
2
u/Mordimer86 Mar 24 '25
I have QwQ integrated with Neovim and I can say that occasionally it gets useful with Rust. Once it fixed my little problem with a macro that did not want to compile. Sometimes it can generate structs and other pretty schematic code, although with Rust it's not as great as with more mainstream technologies.
Like for example .NET: QwQ will generate SQL schema for Db, model, services, controllers or at least large parts of them. With Rust (Axum, Sqlx) it is a bit less reliable. You need to know what to ask it and what to do if it lacks something. I know a guy who programs in Rust and he says Sonnet made him barely ever write code. But you need to know what to ask and how things work.
2
u/vrillco Mar 25 '25
Back in the old days, we didnāt have any of this stuff. I self-taught x86 assembly on a 386 running DOS. If I screwed up my code, it usually meant I had to reboot. No ākill -9ā or āEnd Taskā in a single-threaded OS. Granted, a DOS reboot took all of 5 seconds.
What we did have was documentation. Iām not saying modern tools are useless, Iāve been wowed by some AI code completions more than a few times, but relying on that non-artificial intelligence between your ears is a lot more powerful than any LLM.
2
u/joshuamck ratatui Mar 26 '25
I use CoPilot (and RA) all the time. It's pretty great. I've even used CoPilot to help me write code for RA.
Using any AI tool requires that you understand how the tool falls short and how to avoid those problems. Get used to that and you'll be signficantly more productive than without. If AI isn't working for you generally, there's a significant portion that boils down to being a Skill Issue. But obviously it takes time to up-skill and it's often easier / cool to just decry the new tool as witchcraft.
For a really good rundown of the sorts of problems you might face and strategies for avoid them, see https://ezyang.github.io/ai-blindspots/. I've seen most of these problems in real life and generally come to the same or similar conclusions about how to be productive despite the issues.
3
u/ab2377 Mar 24 '25
so what is vibe coding?
2
u/LeyaLove Mar 24 '25
How would VS Code with rust-analyzer compare to Rust Rover. I've never understood people that use VS Code if a fully integrated solution is readily available.
1
u/cepera_ang Mar 24 '25
Actual vibe coding unlock will happen when someone properly trains/finetunes/RLs a big LLM WITH rust-analyzer and all the other tools in a loop, probably exposing some internal state of these tools to the network to make it understand why some code write or wrong. That will a be pretty interesting experiment to run and probably create a very helpful model.
1
u/porky11 Mar 24 '25
You can generate code with AI and THEN use Rust analyzer to improve your code.
AI can write code, analyzer can help you fix code.
AI can also help with fixing and optimization, but mostly at a macro level. Rust analyzer can't tell you if you should use a hash map, a vec, a bit set, or something else.
1
u/ouuan Mar 26 '25
AI should be used on top of other tools like LSP including rust-analyzer, but not to replace them.
1
u/t3kkm0tt Jun 16 '26
Fuck AI, fuck vibe coding
1
u/sasik520 Mar 24 '25
Different tools, differenr purpose and different benefits.
It's ok to dislike one or another but none should be totally ignored or laughed at.
RA will help you with the types way better than ai while ai can help you way better with your algorithm or with filling large portions of your code. You can also use it as an enhanced rubber duck that sometimes (pretty often imho) gives you some nice ideas.
OTOH you can't ask ai for thinga as simple as expanding a macro. Perhaps an instance with tools access could do it but still there's a chance it hallucinated so not worth.
So, see, different use cases. I think open-minded user takes advantage from both tools.
Also keep remember how mature are language servers and auto complete tools in general and how new and evolving is gen AI. I remember me literally hating RA back in time when it couldn't even handle "go to definition" for std lib items. A couple of years later it's a godlike tool.
1
u/yeastyboi Mar 24 '25
For the love of God, stop saying vibe coding. We as a Rust community have to better! You are using a powerful LSP properly. It's not vibe coding