We've had requests for this for a while, and we'd generally like to see it happen. The previous round: pre-RFC: Enable setting of source file, line & column - #8 by CAD97
As evidenced by that discussion, this is endlessly bikesheddable.
Summary:
- Should this be something that appears in a Rust source file, or should it be a separate file of metadata, such as a source map?
- How can we specify the original source file name, and the line and column numbers?
- Should this be an attribute or a built-in macro? The latter could be inserted somewhere that isn't an item.
- What should this be called? And should it be in a namespace (e.g.
diagnostic::
)? - How precisely does this interact with macros?
- What's the precise specification of which character in the construct has its line/column correspond to what's mentioned in the attribute/macro?
Personally, based on the above-linked thread, I'm tempted by the idea of feeding a source map into the compiler and having this be entirely outside the scope of the text of a Rust source file.