Skip to content

Naming of proc_macro::Span::local_file() #139903

Open
@m-ou-se

Description

@m-ou-se

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.

Metadata

Metadata

Assignees

Labels

A-proc-macrosArea: Procedural macrosC-discussionCategory: Discussion or questions that doesn't represent real issues.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions