Skip to content

Remove #[cfg(proc_macro_span)] from span-locations #509

@nurmohammed840

Description

@nurmohammed840

Hello,

Currently, the implementation of Span::start() (and related functions) under the span-locations feature is guarded
by #[cfg(proc_macro_span)].

proc-macro2/src/wrapper.rs

Lines 431 to 443 in fc2ae0f

#[cfg(span_locations)]
pub(crate) fn start(&self) -> LineColumn {
match self {
#[cfg(proc_macro_span)]
Span::Compiler(s) => LineColumn {
line: s.line(),
column: s.column().saturating_sub(1),
},
#[cfg(not(proc_macro_span))]
Span::Compiler(_) => LineColumn { line: 0, column: 0 },
Span::Fallback(s) => s.start(),
}
}

This condition bypass span information (such as line and column numbers).

However those function are stabilized in Version 1.88.0

Proposal: Remove #[cfg(proc_macro_span)] attribute

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions