Skip to content

Commit fc5678f

Browse files
committed
Defer stabilizing span hygiene until after 1.45 release
1 parent 0283321 commit fc5678f

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

src/fallback.rs

+3
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ impl Span {
374374
Span { lo: 0, hi: 0 }
375375
}
376376

377+
#[cfg(procmacro2_semver_exempt)]
377378
#[cfg(hygiene)]
378379
pub fn mixed_site() -> Span {
379380
Span::call_site()
@@ -384,13 +385,15 @@ impl Span {
384385
Span::call_site()
385386
}
386387

388+
#[cfg(procmacro2_semver_exempt)]
387389
pub fn resolved_at(&self, _other: Span) -> Span {
388390
// Stable spans consist only of line/column information, so
389391
// `resolved_at` and `located_at` only select which span the
390392
// caller wants line/column information from.
391393
*self
392394
}
393395

396+
#[cfg(procmacro2_semver_exempt)]
394397
pub fn located_at(&self, other: Span) -> Span {
395398
other
396399
}

src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ impl Span {
353353
/// of the macro. This is the same hygiene behavior as `macro_rules`.
354354
///
355355
/// This function requires Rust 1.45 or later.
356+
#[cfg(procmacro2_semver_exempt)]
356357
#[cfg(hygiene)]
357358
pub fn mixed_site() -> Span {
358359
Span::_new(imp::Span::mixed_site())
@@ -368,12 +369,14 @@ impl Span {
368369

369370
/// Creates a new span with the same line/column information as `self` but
370371
/// that resolves symbols as though it were at `other`.
372+
#[cfg(procmacro2_semver_exempt)]
371373
pub fn resolved_at(&self, other: Span) -> Span {
372374
Span::_new(self.inner.resolved_at(other.inner))
373375
}
374376

375377
/// Creates a new span with the same name resolution behavior as `self` but
376378
/// with the line/column information of `other`.
379+
#[cfg(procmacro2_semver_exempt)]
377380
pub fn located_at(&self, other: Span) -> Span {
378381
Span::_new(self.inner.located_at(other.inner))
379382
}

src/wrapper.rs

+3
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ impl Span {
376376
}
377377
}
378378

379+
#[cfg(procmacro2_semver_exempt)]
379380
#[cfg(hygiene)]
380381
pub fn mixed_site() -> Span {
381382
if inside_proc_macro() {
@@ -394,6 +395,7 @@ impl Span {
394395
}
395396
}
396397

398+
#[cfg(procmacro2_semver_exempt)]
397399
pub fn resolved_at(&self, other: Span) -> Span {
398400
match (self, other) {
399401
#[cfg(hygiene)]
@@ -408,6 +410,7 @@ impl Span {
408410
}
409411
}
410412

413+
#[cfg(procmacro2_semver_exempt)]
411414
pub fn located_at(&self, other: Span) -> Span {
412415
match (self, other) {
413416
#[cfg(hygiene)]

0 commit comments

Comments
 (0)