I’m trying to get a prototype together that uses rustc to typecheck an expr very fast (I’m aiming for <100ms). This is to help the ide tools initiative (+ my racer project).
By dynamically stripping the input text as it is loaded into rustc I was able to get typecking down to sub-second (Some more info here ). Unfortunately I think getting the time down significantly below this will require some caching of typeck’d HIR and side tables.
The approach I’m considering is to load and typecheck a skeleton ast of just type signatures (no function bodies), and then somehow just load and typeck individual function bodies on demand. It’s not clear to me the best way to achieve this, but it looks like I would need to modify all the stages to be able to process an Item rather than a full Crate.
Can anybody with rustc experience suggest if there’s a hack or shortcut I’m missing? Maybe there’s some way I could create a dummy crate to process just the function, but using the side-tables from the other crate?
Any suggestions or pointers would be much appreciated!