The reading I’ve done has strengthened my original gut feel that Rust
would be worthwhile to learn - but I can only read so much before I
feel the need to turn theory into practice. So here goes. A series of
short experiments designed to help me learn and understand Rust.

> which rust
/usr/local/bin/rust
> rust -v
rust 0.8
host: x86_64-apple-darwin
> rust
The rust tool is a convenience for managing rust source code.
It acts as a shortcut for programs of the rust tool chain.
Usage: rust <command> [arguments]
The commands are:
build compile rust source files
run build an executable, and run it
test build a test executable, and run it
doc generate documentation from doc comments
pkg download, build, install rust packages
sketch run a rust interpreter
help show detailed usage of a command
Use "rust help <command>" for more information about a command.

sketch seems cool (and I love irb), but I couldn’t actually get it
to do anything useful other than segfault. Another day.

I then opened up a Emacs buffer and pasted in the hello world example
from the Rust home page:

fnmain(){println("hello?");}

Looking at the output of the rust command, I simply used rust run
and it worked:

I thought it a bit odd that the compilation took longer than with the
rust run and that the execution was faster. So I ran each a few
times, and it turned out to just be a fluke :-).

Having gotten this working, I wanted to spend a little time investing
in seeing what support Emacs has for Rust, beyond just syntax
highlighting. One of the mistakes I’ve made in the past is to ignore
this step until later. Having everything in one place (e.g. no alt-tab
to run your tests/compile) really helps (me, at least) with focus.

The Rust wiki
talks about installing and configuring rust-mode. Joyfully, it
mentions syntax checking using
flycheck, which I wasn’t
familiar with. It claims to be “flymake done right” - I have no idea
what was wrong with flymake since it always worked well for me :-).

After installing flycheck with package-install, I swapped to my
rust.rs buffer and enabled the mode with M-x flycheck-mode. That
didn’t work and I got very little feedback (i.e. “cannot find the rust
executable” would have been nice). +1 for flymake :-). With
M-x flycheck-select-checker RET rust RET I got an error saying it
couldn’t find the executable. Sounds like a path issue to me (under
OSX, Emacs isn’t started via a shell). I fixed this with M-x
customize-variable RET exec-path RET and using the UI to add
/usr/local/bin. I then got a syntax error in my rust.rs buffer but
it wasn’t obvious to me how to see what the error was. I don’t know
what the real answer is here (I’ll have to see what fits), but it
seems like flycheck-list-errors is a goodie.

At this point I have an editor with syntax highlighting, that can tell
me about syntax errors and I can compile and run a simple hello world
program. Next time, I think I want to take a look at getting a simple
object oriented program going (with tests).