Define line number and filename e.g. for generated files (#line directive)

Is the #line directive in any way available in Rust?

C/C++ preprocessors have it, for example (see Preprocessor directives - C++ Tutorials), which is very helpful to create nice error messages for generated code. It can be used to show the erroneous line and filename of the original template instead of the position in the generated file.

The line!() macro.

There's a misunderstanding, I want to set the line number (and filename), not retrieve it. Or for C++ devs, #line instead of __LINE__/__FILE__.

There isn't any equivalent at the moment; I don't think anyone has even proposed a design.

Oh. Sorry, I should learn to read...

Syntax extensions can alter with spans in this way but things like macro_rules! macros cannot.