@@ -929,23 +929,23 @@ impl Debug for Literal {
929929 }
930930}
931931
932- /// Invalidates any `proc_macro2::Span` on the current thread
932+ /// Invalidate any `proc_macro2::Span` that exist on the current thread.
933933///
934- /// The implementation of the `proc_macro2::Span` type relies on thread-local
935- /// memory and this function clears it. Calling any method on a
936- /// `proc_macro2::Span` on the current thread and that was created before this
937- /// function was called will either lead to incorrect results or abort your
938- /// program.
934+ /// The implementation of `Span` uses thread-local data structures and this
935+ /// function clears them. Calling any method on a `Span` on the current thread
936+ /// created prior to the invalidation will return incorrect values or crash.
939937///
940- /// This function is useful for programs that process more than 2^32 bytes of
941- /// text on a single thread. The internal representation of `proc_macro2::Span`
942- /// uses 32-bit integers to represent offsets and those will overflow when
943- /// processing more than 2^32 bytes. This function resets all offsets and
944- /// thereby also invalidates any previously created `proc_macro2::Span`.
938+ /// This function is useful for programs that process more than 2<sup>32</sup>
939+ /// bytes of Rust source code on the same thread. Just like rustc, proc-macro2
940+ /// uses 32-bit source locations, and these wrap around when the total source
941+ /// code processed by the same thread exceeds 2<sup>32</sup> bytes (4
942+ /// gigabytes). After a wraparound, `Span` methods such as `source_text()` can
943+ /// return wrong data.
945944///
946- /// This function requires the `span-locations` feature to be enabled. This
947- /// function is not applicable to and will panic if called from a procedural
948- /// macro.
945+ /// # Panics
946+ ///
947+ /// This function is not applicable to and will panic if called from a
948+ /// procedural macro.
949949#[ cfg( span_locations) ]
950950pub fn invalidate_current_thread_spans ( ) {
951951 if inside_proc_macro ( ) {
0 commit comments