Stream: t-compiler/wg-rls-2.0

Topic: Interface files


Florian Diebold (Mar 21 2019 at 20:47, on Zulip):

By the way, I was thinking about how we could provide std lib support if rust-analyzer#1007 was implemented (a bit prematurely, I've got to admit ;) ) and I had an idea: It should be possible to take a crate, parse and macroexpand it, and then basically write a big .rs file containing only its public API, with docstrings etc. but without bodies or private items. So it would basically be a valid rust file syntactically and provide the same public interface as the original crate, but it wouldn't typecheck or be compilable. But we'd be able to load it instead of the original crate, hopefully a lot faster, and maybe even e.g. bundle it with the WASM version...

Of course a binary format would be even faster and smaller, but we'd also need to worry about compatibility, and implement serialization etc., whereas this seems like it'd actually be relatively easy to do...

matklad (Mar 22 2019 at 05:06, on Zulip):

Heh, Swift works like this: their intermediate language, SIL, is textual and is parsed by the same parser that deals with source

Last update: Nov 19 2019 at 18:45UTC