I’m working with someone building a cross-language state machine generated with m4, generating millions of lines of Rust code. m4’s
-s option generates cpp-compatible
#line directives that look like this:
#line 42 "generator.m4"
Such a directive provides the line number and optional filename for the start of the following line; rustc can then increment the line number as normal unless it sees another such directive.
Tracking down errors in the generated code becomes much easier if Rust can attribute that code to the appropriate part of the generator. Thus, I’d like to suggest an RFC to (optionally) handle
This doesn’t necessarily need to occur by default; it’d be fine if doing so required some special
include_generated!("...") or similar.
Due to the large number of tools that already know how to generate
#line directives, it would help if Rust could parse those directives unmodified, rather than requiring Rust-style