[rust-dev] Improving rustc error messages

Tony Arcieri bascule at gmail.com
Tue Jan 21 21:48:41 PST 2014

I think the biggest thing I've struggled with learning Rust is what I will
call, for lack of a better phrase, "shit rustc says". Reading Steve
Klabnik's tutorial and some blog posts about earlier versions of rust, it's
clear that the error messages have improved dramatically since earlier
versions, but I still think there's quite a bit of room for improvement.

For an example of how errors could be presented better, I'd look to
Facebook's typed PHP language, Hack, which was presented at Strange Loop
2013. Hack supports a pretty fancy type system for a gradually typed
language, complete with subtyping (which PHP necessitates) and non-nullable

Hack uses a story format for error messages in order to make them easier to

  File "test.php", line 6, characters 10-11:
Invalid return type
File "test.php", line 3, characters 24-26:
This is an int
File "test.php", line 5, characters 10-11:
It is incompatible with a string

If rustc could do something like this, I think it'd make the errors a lot
easier to understand and provide for easier debugging.

For more information on Hack, check out the talk on InfoQ:


Or the slides:


Tony Arcieri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20140121/aea598c0/attachment.html>

More information about the Rust-dev mailing list