Lukas Wirth

Lukas Wirth

@lukaswirth.dev

Rust Engineer at @zed.dev rust-analyzer team lead Sponsor my rust-analyzer work here https://github.com/sponsors/Veykril

642 followers332 following156 posts

Lukas Wirth reposted

Just got my first real sale for @avette.eu ✨ super super happy about it. It's a dictation app for macOS, the productized version of what I've been using for a year. It's really very good, I encourage you to download and try it out, should be fresh air after whisper/parakeet/apple stuff x)

Lukas Wirth reposted

secretly wishing to be targeted to fulfill my self image as a "prominent rustacean"

Rust Language@rust-lang.org

⚠️ We believe that there is an ongoing campaign targeting owners of popular crates and rust-lang team members that is attempting to compromise devices and accounts in order to use them to publish malware. See our blog post for details: blog.rust-lang.org/2026/09/17/t...

It is so easy to tell if someone used claude to write a PR. 60% of the diff is comments that explain nothing of value? Yep, must have been a claude model

Lukas Wirth reposted

never stash! it's just a commit! never stage! it's just a commit! resolve those conflicts now, or later! it's just a commit!

Ellie Huxtable@ellie.wtf

jj is actually starting to properly stick this time this makes so much sense fuck git stash

Love a package getting stuck in customs for 4 weeks for it to just get sent back because I have never been informed by customs about the package ...

Starting the morning by having to review a pull request that merely changes a complex regex. Thus my morning is already in shambles as I am tasked to review a change in an unreadable language.

Lukas Wirth reposted

Lukas Wirth reposted

"Vestige" It's been a while since I last dedicated an illustration to this duo and I wanted to practice drawing desert scenes again, so here's the result c:

Lukas Wirth reposted

hey uhhh. I got fired yesterday. if anyone has rust positions in the Netherlands let me know!

This can vastly speed up initial project indexing depending on your project as the proc-macro server process can only expand a single macro at a given time (due to macros observing the process environment). Once rust-analyzer becomes a bit more parallel it will also speed up things in general.

Lukas Wirth reposted

my "this isn't meant to be used for harassment" sign i put on my list of enemies is raising a lot of questions answered by the sign

View full thread

The annoying part, you can't trivially parallelize this on the proc-macro server because proc-macros execute in (and are in control 😵‍💫 of) the process environment, so technically running multiple at once can cause issues. But even ignoring that they can change the environment,

we'd still only be able to execute proc-macros in parallel if they are run within the same environment (working dir, env vars) which only happens within the same crate really. So the alternative we are likely looking at is to just spawn multiple servers and handle them like a process pool.

For context as to why we still cannot implement `expand_expr`, that feature effectively turns all proc-macro into eager macro expansions which would basically prevent rust-analyzer from doing a lot of incremental caching, so we just cannot implement this as designed doc.rust-lang.org/stable/proc_...

doc.rust-lang.orgTokenStream in proc_macro - RustThe main type provided by this crate, representing an abstract stream of tokens, or, more specifically, a sequence of token trees. The type provides interfaces for iterating over those token trees and...

And some additional notes for parallel proc-macro expansion, today r-a spawns a single proc-macro server that does expansion one at a time, meaning whenever r-a wants to expand a proc-macro, it takes a global lock on the proc-macro server!

Turns out the TokenStream implementation of rust-analyzer's proc-macro server is super slow when it comes to one of the most common proc-macro operations: concatenation. I noticed that in Zed's codebase, there were ~4 derives that just straight up together took 8 seconds to expand in rust-analyzer.

View full thread

And sure enough, this changed the 8 second expansion time into a 100ms! A bit more info can be found in the PR description here github.com/rust-lang/ru.... This should improve general speed of rust-analyzer in the majority of projects given how pervasive these kinds of macros are in Rust.

github.comproc-macro-srv: Reimplement token trees via immutable trees by Veykril · Pull Request #21097 · rust-lang/rust-analyzerFor macros, rust has the concept of TokenTrees and TokenStreams which are basically a tree-like form of the underlying tokenized input with (){}[] delimiters forming Groups (internal nodes) and all...

Turns out the TokenStream implementation of rust-analyzer's proc-macro server is super slow when it comes to one of the most common proc-macro operations: concatenation. I noticed that in Zed's codebase, there were ~4 derives that just straight up together took 8 seconds to expand in rust-analyzer.

View full thread

And sure enough, this changed the 8 second expansion time into a 100ms! A bit more info can be found in the PR description here github.com/rust-lang/ru.... This should improve general speed of rust-analyzer in the majority of projects given how pervasive these kinds of macros are in Rust.

github.comproc-macro-srv: Reimplement token trees via immutable trees by Veykril · Pull Request #21097 · rust-lang/rust-analyzerFor macros, rust has the concept of TokenTrees and TokenStreams which are basically a tree-like form of the underlying tokenized input with (){}[] delimiters forming Groups (internal nodes) and all...

Oh almost forgot! For the folks using RustRover, you will benefit from this too as RustRover uses the proc-macro server for its proc-macro expansion as well!

This proc-macro server change coupled with the other cache priming improvements I landed this week cut the time it takes for rust-analyzer to finish its initial indexing by 35% on Zed! It's still 53 seconds, but hey, it was at 80 seconds before so ...

Turns out the TokenStream implementation of rust-analyzer's proc-macro server is super slow when it comes to one of the most common proc-macro operations: concatenation. I noticed that in Zed's codebase, there were ~4 derives that just straight up together took 8 seconds to expand in rust-analyzer.

All that proc-macro was doing though is `quote!`ing a bunch, not much more. So I spent the day rewriting the implementation of TokenStream used by the server to make use of an immutable shared tree instead to get super cheap concatenations.

Lukas Wirth reposted

It's finally here. Zed is available on Windows. Built from scratch, and rendering at 1 million pixels/millisecond. Download it today 👇

They should add a lint to clippy that warns on lines that contain too long string literals for rustfmt to handle. I should not need to hunt for string literals to break down with `\` manually just to get rustfmt working again 😒

Learning way too much about python virtual environments right now and I feel even more sorry for people using this as their primary programming language now

Lukas Wirth reposted

Zed has raised a $32M Series B, led by Sequoia Capital. We’re full speed ahead making a great editor, but there’s a bigger picture: we're building DeltaDB, a new kind of database for collaborative coding. Early days, but the vision is clear: zed.dev/blog/sequoia...

We just merged the initial trait solver migration PR into rust-analyzer 🎉 Thanks a ton to Jack for their tremendous work! We'll pause our (stable) releases for a bit in case of major usability regressions but please give the pre-release a spin on your projects! github.com/rust-lang/ru...

github.comSwitch from Chalk to the next trait solver by jackh726 · Pull Request #20329 · rust-lang/rust-analyzerAt this point, opening up for general review, though I don't think this is fully ready to merge. Some checklist (non-exhaustive) of things to do before/after merge (feel free to edit): Before: ...

Lukas Wirth reposted

Howdy all. I'm unfortunately not going to be with my employer for much longer due to team relocation. If anyone has any info on roles that would allow me to continue my Rust compiler work (in New York City), they'd be greatly appreciated.