Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ matrix:
- cargo test --no-default-features
- cargo test --no-default-features -- --ignored # run the ignored test to make sure the `proc-macro` feature is disabled
- cargo test --features span-locations
- cargo test --features force-fallback
- RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test
- RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo test --no-default-features
- RUSTFLAGS='-Z allow-features=' cargo test
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ span-locations = []
# This feature no longer means anything.
nightly = []

# Force use fallback implementation
force-fallback = []

[badges]
travis-ci = { repository = "alexcrichton/proc-macro2" }

Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ use std::str::FromStr;
mod strnom;
mod fallback;

#[cfg(not(wrap_proc_macro))]
#[cfg(any(feature = "force-fallback", not(wrap_proc_macro)))]
use crate::fallback as imp;
#[path = "wrapper.rs"]
#[cfg(wrap_proc_macro)]
#[cfg(all(not(feature = "force-fallback"), wrap_proc_macro))]
mod imp;

/// An abstract stream of tokens, or more concretely a sequence of token trees.
Expand Down Expand Up @@ -378,13 +378,13 @@ impl Span {
/// 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)]
#[cfg(all(not(feature = "force-fallback"), wrap_proc_macro))]
pub fn unwrap(self) -> proc_macro::Span {
self.inner.unwrap()
}

// Soft deprecated. Please use Span::unwrap.
#[cfg(wrap_proc_macro)]
#[cfg(all(not(feature = "force-fallback"), wrap_proc_macro))]
#[doc(hidden)]
pub fn unstable(self) -> proc_macro::Span {
self.unwrap()
Expand Down