Fix the `nightly` feature outside of rustc
This commit is a stab at getting the `proc_macro2` crate to function outside the
context of the compiler, **even when the `nightly` feature is enabled**.
Previously when the `nightly` feature was enabled then `proc_macro2` would panic
at runtime because `proc_macro` itself would panic at runtime due to the lack of
the compiler being initialized.
In this commit the `unstable` module in `proc_macro2` no longer unconditionally
uses the `proc_macro` upstream crate but is rather an `enum` over the upstream
crate and the `stable` module. At runtime the appropriate implementation is
dynamically selected depending on which works.
This brings up some uncomfortable issues such as what happens when you try to
psas a "stable span" to a "nightly `Literal`", but I think we can paper over
these issues in time by further canonicalizing everything to nightly/stable if
it comes up.
One caveat this brings up is that `Span::unstable` unconditionally panics when
outside the compiler, but I think that's expected regardless.
diff --git a/src/strnom.rs b/src/strnom.rs
index f5dd145..e465b03 100644
--- a/src/strnom.rs
+++ b/src/strnom.rs
@@ -4,7 +4,7 @@
use unicode_xid::UnicodeXID;
-use imp::LexError;
+use stable::LexError;
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cursor<'a> {