Skip to content

Commit 64778fc

Browse files
committed
Move invalidate_current_thread_spans to proc_macro2::extra
1 parent 58861e6 commit 64778fc

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/extra.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ use crate::marker::{ProcMacroAutoTraits, MARKER};
77
use crate::Span;
88
use core::fmt::{self, Debug};
99

10+
#[cfg(span_locations)]
11+
#[cfg_attr(doc_cfg, doc(cfg(feature = "span-locations")))]
12+
pub use crate::imp::invalidate_current_thread_spans;
13+
1014
/// An object that holds a [`Group`]'s `span_open()` and `span_close()` together
1115
/// in a more compact representation than holding those 2 spans individually.
1216
///

src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,6 @@ use std::error::Error;
171171
#[cfg(procmacro2_semver_exempt)]
172172
use std::path::PathBuf;
173173

174-
#[cfg(span_locations)]
175-
#[cfg_attr(doc_cfg, doc(cfg(feature = "span-locations")))]
176-
pub use crate::imp::invalidate_current_thread_spans;
177-
178174
#[cfg(span_locations)]
179175
#[cfg_attr(doc_cfg, doc(cfg(feature = "span-locations")))]
180176
pub use crate::location::LineColumn;

src/wrapper.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ impl Debug for Literal {
950950
pub fn invalidate_current_thread_spans() {
951951
if inside_proc_macro() {
952952
panic!(
953-
"proc_macro2::invalidate_current_thread_spans is not available in procedural macros"
953+
"proc_macro2::extra::invalidate_current_thread_spans is not available in procedural macros"
954954
);
955955
} else {
956956
crate::fallback::invalidate_current_thread_spans();

tests/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,7 @@ fn test_invalidate_current_thread_spans() {
775775
let actual = format!("{:#?}", create_span());
776776
assert_eq!(actual, "bytes(3..4)");
777777

778-
proc_macro2::invalidate_current_thread_spans();
778+
proc_macro2::extra::invalidate_current_thread_spans();
779779

780780
let actual = format!("{:#?}", create_span());
781781
// Test that span offsets have been reset after the call
@@ -789,7 +789,7 @@ fn test_invalidate_current_thread_spans() {
789789
fn test_use_span_after_invalidation() {
790790
let span = create_span();
791791

792-
proc_macro2::invalidate_current_thread_spans();
792+
proc_macro2::extra::invalidate_current_thread_spans();
793793

794794
span.source_text();
795795
}

0 commit comments

Comments
 (0)