Doc comments break proc_macro::SourceFile #62892
Labels
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Adding a doc comment before a procedural macro invocation causes
proc_macro::SourceFile::path
to return the path to lib.rs or main.rs instead of the actual path. The documentation states that ifproc_macro::SourceFile::is_real
returns false, the returned path may not be an actual path on the filesystem, but this is not the case(it returns true and the path is a real path). I originally found the issue in unneon/icie@53a9913.I tried this code:
I expected to see this happen: during compilation, these two lines are printed to stderr:
Instead, this happened: these two lines were printed:
Meta
rustc 1.38.0-nightly (07e0c36 2019-07-16)
binary: rustc
commit-hash: 07e0c36
commit-date: 2019-07-16
host: x86_64-unknown-linux-gnu
release: 1.38.0-nightly
LLVM version: 8.0
The text was updated successfully, but these errors were encountered: