Skip to content

Commit facc69f

Browse files
committed
Stabilize Span::resolved_at + Span::located_at with hygiene feature
These were stabilized in Rust in rust-lang/rust#69041
1 parent f093323 commit facc69f

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ default = ["proc-macro"]
3636
# of a token.
3737
span-locations = []
3838

39+
# Span::mixed_site, Span::resolved_at, and Span::located_at. Requires rustc 1.45+
3940
hygiene = []
4041

4142
# This feature no longer means anything.

src/fallback.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,15 @@ impl Span {
384384
Span::call_site()
385385
}
386386

387-
#[cfg(procmacro2_semver_exempt)]
387+
#[cfg(hygiene)]
388388
pub fn resolved_at(&self, _other: Span) -> Span {
389389
// Stable spans consist only of line/column information, so
390390
// `resolved_at` and `located_at` only select which span the
391391
// caller wants line/column information from.
392392
*self
393393
}
394394

395-
#[cfg(procmacro2_semver_exempt)]
395+
#[cfg(hygiene)]
396396
pub fn located_at(&self, other: Span) -> Span {
397397
other
398398
}

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,17 +371,17 @@ impl Span {
371371
/// Creates a new span with the same line/column information as `self` but
372372
/// that resolves symbols as though it were at `other`.
373373
///
374-
/// This method is semver exempt and not exposed by default.
375-
#[cfg(procmacro2_semver_exempt)]
374+
/// This method requires the `"hygiene"` feature to be enabled.
375+
#[cfg(hygiene)]
376376
pub fn resolved_at(&self, other: Span) -> Span {
377377
Span::_new(self.inner.resolved_at(other.inner))
378378
}
379379

380380
/// Creates a new span with the same name resolution behavior as `self` but
381381
/// with the line/column information of `other`.
382382
///
383-
/// This method is semver exempt and not exposed by default.
384-
#[cfg(procmacro2_semver_exempt)]
383+
/// This method requires the `"hygiene"` feature to be enabled.
384+
#[cfg(hygiene)]
385385
pub fn located_at(&self, other: Span) -> Span {
386386
Span::_new(self.inner.located_at(other.inner))
387387
}

src/wrapper.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ impl Span {
394394
}
395395
}
396396

397-
#[cfg(super_unstable)]
397+
#[cfg(hygiene)]
398398
pub fn resolved_at(&self, other: Span) -> Span {
399399
match (self, other) {
400400
(Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.resolved_at(b)),
@@ -403,7 +403,7 @@ impl Span {
403403
}
404404
}
405405

406-
#[cfg(super_unstable)]
406+
#[cfg(hygiene)]
407407
pub fn located_at(&self, other: Span) -> Span {
408408
match (self, other) {
409409
(Span::Compiler(a), Span::Compiler(b)) => Span::Compiler(a.located_at(b)),

0 commit comments

Comments
 (0)