At the moment libsyntax
always loads source code from the file system when it imports a module. All source code loading seems to go through syntax::parse::file_to_filemap()
.
It should be easy add a CodebaseAccessor
to ParseSess
to which file_to_filemap()
delegates the mapping from file name to source string. How the CodebaseAccessor
then provides the source string could be pretty much anything.
One use case for this would be IDE’s which want to use libsyntax
/librustc
but want to provide it with source file version’s which don’t exist on disk yet.
I hope to get around to implementing this some time but I’d like to get some feedback on the idea first. Also, I haven’t investigated how this would interact with macros loaded from plugins. If someone knows anything about this, I’d be very interested in hearing about it.