-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.I-libs-api-nominatedNominated for discussion during a libs-api team meeting.Nominated for discussion during a libs-api team meeting.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
This is about #54725's open question on the name of local_file
:
The unstable API is now:
impl Span {
/// The path to the source file in which this span occurs, for display purposes.
///
/// This might not correspond to a valid file system path.
///
/// It might be remapped (e.g. `/src/lib.rs`) , or might be an artificial path (e.g. `"<command line>"`).
pub fn file(&self) -> String;
/// The path to the source file in which this span occurs on the local file system.
///
/// This is unaffected by path remapping.
///
/// This path should not be embedded in the output of the macro; prefer `file()` instead.
pub fn local_file(&self) -> Option<PathBuf>;
}
The question is: What should we name local_file
?
Keeping it as local_file
is an option, but maybe we can think of something better.
de-vri-es, chmanie and davisp
Metadata
Metadata
Assignees
Labels
A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.I-libs-api-nominatedNominated for discussion during a libs-api team meeting.Nominated for discussion during a libs-api team meeting.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.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
m-ou-se commentedon Apr 16, 2025
FWIW, rustc internally uses "LocalPath" for this:
rust/compiler/rustc_span/src/lib.rs
Line 196 in 9857284
m-ou-se commentedon Apr 16, 2025
I personally think
local_file
is good enough.proc_macro::Span
inspection APIs #54725proc-macro2
usage for latest nightly solana-foundation/anchor#3663m-ou-se commentedon Apr 17, 2025
@rust-lang/libs-api If you have an opinion/ideas, please speak up!
BurntSushi commentedon Apr 17, 2025
I weakly prefer
path
/local_path
, but I don't feel strongly.m-ou-se commentedon Apr 30, 2025
We discussed this last week in the libs-api meeting. We didn't have any better ideas than
local_file
.I'll make a PR to stabilize it under that name and propose an FCP.
11 remaining items