aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2019-01-16 12:13:15 -0800
committerDavid Tolnay <dtolnay@gmail.com>2019-01-16 12:13:22 -0800
commitc0425cd7f9c240835cad1c71e53c399926659dbb (patch)
tree92337a6b01b408b5448b101996ed19ba34d1f41d /src/lib.rs
parentb0778c53383771c166175d7c848e30302d24f89c (diff)
downloadproc-macro2-c0425cd7f9c240835cad1c71e53c399926659dbb.tar.gz
Better panic on Span::unstable outside of proc macro
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 347b937..c71afd7 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -337,6 +337,12 @@ impl Span {
///
/// This method is available when building with a nightly compiler, or when
/// building with rustc 1.29+ *without* semver exempt features.
+ ///
+ /// # Panics
+ ///
+ /// Panics if called from outside of a procedural macro. Unlike
+ /// `proc_macro2::Span`, the `proc_macro::Span` type can only exist within
+ /// the context of a procedural macro invocation.
#[cfg(wrap_proc_macro)]
pub fn unstable(self) -> proc_macro::Span {
self.inner.unstable()