-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed as not planned
Closed as not planned
Copy link
Labels
A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Summary
With this feature, proc macros (like askama::Template
) could parse external files and then emit diagnostics with appropriate spans.
Proposed API
Other APIs are possible, but I was thinking of something like this:
impl SourceFile {
pub fn span(&self) -> Span { ... }
pub fn contents(&self) -> &str { ... }
pub fn load(path: &Path) -> Self { ... }
}
I'm not super familiar with the proc_macro
API, so feel free to suggest better API designs.
See also
See this discussion on Zulip and this discussion on GitHub for why I think this feature would be useful.
compiler-errors, beepster4096 and clubby789Kijewski and ia0
Metadata
Metadata
Assignees
Labels
A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.