Announcing rustw - a web frontend for the Rust compiler


#1

https://github.com/nrc/rustw (there are some screenshots in the README and a link to a demo (although it is very slow and lacks some functionality)).

Rustw is an experiment I’ve been working on recently, it is still very early days, but I’d love to get some early feedback. It is a frontend for the Rust compiler (or Cargo) and is primarily designed to be a better way to present errors to the user. It runs cargo build or whatever build command you specify, but instead of displaying the results in the console, it displays them in the browser. This is prettier, but also more usable since you can control the level of detail displayed (e.g., hiding notes or source snippets), jump to a source view, easily make edits to the code, or show explanations about error codes, etc. To rebuild, just hit F5.

In the future, I would like to leverage the graphical interface to show better information about borrows, interact with macro expansion, etc. I’d like rustw to be an easy way to use multiple toolchains, effectively being a UI for multirust/rustup.rs. I’d also like to use this as a platform for code exploration - implementing some of the features from DXR such as ‘jump to definition’, ‘find uses’, and ‘identifier search’.

As I said, it is very rough at the moment, but please have a play around and let me know what you think. If anyone is interested on hacking on rustw, let me know!


#2

I really love the idea of enriching rust with a web-based experience – it’s something that can give a lot of the benefits of an IDE without requiring any particular IDE to be installed or set up. As @nrc says, these benefits include showing much richer information about errors, as well as source code navigation and metadata.

Unlike full IDE integration, these are benefits we can fairly easily reap today: they don’t require incremental compilation or real-time interaction. Instead, they give you rich access to errors and source code after a (possibly failed) compilation.

One of the other possibilities that excites me here is that some day rustc could include a short URL for each error, letting you jump directly into a rustw view. That way, people who are accustomed to a console-based workflow become aware of and benefit from rustw without any setup or workflow changes. This is a bit like today’s error explainers, but entirely URL-based.


#3

As an avid Emacs user I really appreciate this effort! :smile:

The Rust compilation output is already like having a built-in StackOverflow (read: excellent), but a web based interface could really take it to another level of goodness.


#4

I’m mostly excited for this because it’ll show us a way to make Atom/Emacs/Vi plugins even better in new ways.


#5

@nrc What are the improvements to the structure of errors that are coming, that you mentioned on Twitter? Anything related to macros? It would be cool, for example, to be able to see macro errors inside the expanded code.


#6

I was referring to this PR: https://github.com/rust-lang/rust/pull/32756

There is some ongoing work on better macros stuff, it’s a student project, I’m hopeful about seeing something in rustw, but not for a few months.


#7

At first, I thought this is already rust code compiled into wasm or asm.js.


#8

Cool. Where can we track (now or later), how the format of these error messages will be, with the JSON output? The diagnostics source?


#9

Where can we track (now or later), how the format of these error messages will be, with the JSON output?

Look at https://github.com/rust-lang/rust/blob/master/src/libsyntax/errors/json.rs We’ve talked about stabilising the format fairly quickly at which point there will be an RFC, but we need some experience first so that won’t happen straight away. In the meantime, looking at the source code is the best option.