This book is where I collect various notes about software, mostly focused around Rust.


I recently set up Neovim, as I was no longer enjoying VS Code. Since the projects that I work on require beefy machines to build/test, I have an AWS instance that I SSH to. For the past few years, I have used VS Code Remote Workspaces. However, the workspace model of separating projects was getting kind of annoying. For example, for rustc, you might want to create a git worktree to keep multiple branches checked out at the same time. This means having to create a new VS Code workspace every time you want to create a new git worktree. I'm not sure if you really have to, but since I want to override certain settings to reference the root of the project, it feels like that's the only way to do so. In comparison, with neovim, I don't really have to care about splitting my directories into projects. For neovim, I set my settings once in the Lua config, and it applies to any copy of rustc that I open up.

Neovim was easy to set up, I mostly just used an existing config that I found in a blog post. That config is tailored for Rust development specifically. I made a few tweaks to the rust-analyzer settings, so that they match the recommended workflow mentioned in the rustc-dev-guide. I also added a few plugins:

  • telescope: a fuzzy finder for file, buffers, search-in-buffer, etc (actually this one was already in the original config, so the only thing I did was set up some keybindings)
  • vinegar: improves the default settings of netrw, which is the build-in directory browser. However, I don't think I'll actually be using netrw much, because telescope does the same thing but better
  • gitsigns: adds a git gutter; also adds other stuff but I don't care about them, I only want the gutter
  • indent-blankline: adds a vertical guide line to help see which lines have the same indentation levels. This one is essential.
  • lualine: an improved statusline. I didn't change any defaults, tbh I'm really lazy with configuration. My days of ricing my arch linux setup ended years and years ago.
  • neogit: basically a port of magit but for neovim. I used magit for many years, so hopefully this one works well. I haven't really tested it out much yet.
  • vim-sneak: useful for jumping around by typing two letters, but honestly, there's a similar plugin for emacs which works much better. The emacs one assigns numbers (or letters? I don't quite remember) to each potential match, so you can jump directly, but with vim-sneak you have to cycle through forwards and backwards to get to the right spot.
  • vim-numbertoggle: switches between regular line numbers and relative line numbers depending on the context

The theme I am using is tokyonight, the night variant.

I don't think I'll really be changing more settings -- this covers like 99% of what I need, and I don't really like editing config files 🫠. If I don't ever have to touch the config again, that would be ideal lol.



Creating new worktree

git worktree add -b my-feature ../rust2 master
cd ../rust2
git submodule update --init --recursive
./ setup
./ build library
rustup toolchain link stage1 build/x86_64-unknown-linux-gnu/stage1
rustc +stage1 -vV
# Running UI tests
./ test --stage=1 --keep-stage=1 src/test/ui/...
# Recompiling
./ build library --keep-stage=1
# Using the compilier we rebuilt (with logs enabled for a module), dump MIR
RUSTC_LOG=rustc_mir_transform=info rustc +stage1 -Z unpretty=mir-cfg ~/code/rs/my/





# n = number of commits you want to see in interactive rebase
git rebase -i HEAD~n

Commits are ordered (top to bottom) from oldest to newest. You can only squash newer commits into older commits. Change any commits you want to squash to say s instead of pick.



Sometimes need to do this:

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/github_id_ed2551


Note: nothing is in a particular order.





The Rust Performance Book

Rust Design Patterns

Rust Forge (supplementary docs for rustc development)

Rust API Guidelines

Rust-analyzer Style Guide


Rust Lang - Compiler Team

Rustc Dev Guide

Std Dev Guide

Nightly rustc docs

The Rust Reference

The Rustonomicon

The Rust Unstable Book

The Embedded Rust Book

Error Handling in Rust

The Big Book of Rust Interop