Proc Macro over external files?


#1

Alternative title: making include! writable out-of-tree.

Add a function proc_macro::TokenStream::read(File) -> io::Result<Self> or similar that reads in the contents of a file and parses it as a TokenStream with the correct Spans.

This would be invaluable for macros that want to process content from an external file (such as many declarative parsing frameworks), as generated names could then point back to their actual definition site in the case of a compiler error such as conflicting names.