Support rust 1.15.0
diff --git a/.travis.yml b/.travis.yml
index 44570fd..e5c59af 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,7 @@
matrix:
include:
- - rust: 1.18.0
+ - rust: 1.15.0
- rust: stable
- rust: beta
- rust: nightly
diff --git a/src/lib.rs b/src/lib.rs
index de3a2e5..fd46433 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -170,13 +170,13 @@
#[cfg(procmacro2_unstable)]
pub fn start(&self) -> LineColumn {
let imp::LineColumn{ line, column } = self.0.start();
- LineColumn { line, column }
+ LineColumn { line: line, column: column }
}
#[cfg(procmacro2_unstable)]
pub fn end(&self) -> LineColumn {
let imp::LineColumn{ line, column } = self.0.end();
- LineColumn { line, column }
+ LineColumn { line: line, column: column }
}
#[cfg(procmacro2_unstable)]
diff --git a/src/stable.rs b/src/stable.rs
index 56c0dd2..d892ae5 100644
--- a/src/stable.rs
+++ b/src/stable.rs
@@ -320,22 +320,18 @@
}
impl Span {
+ #[cfg(not(procmacro2_unstable))]
pub fn call_site() -> Span {
- Span {
- #[cfg(procmacro2_unstable)]
- lo: 0,
- #[cfg(procmacro2_unstable)]
- hi: 0,
- }
+ Span {}
+ }
+
+ #[cfg(procmacro2_unstable)]
+ pub fn call_site() -> Span {
+ Span { lo: 0, hi: 0 }
}
pub fn def_site() -> Span {
- Span {
- #[cfg(procmacro2_unstable)]
- lo: 0,
- #[cfg(procmacro2_unstable)]
- hi: 0,
- }
+ Span::call_site()
}
#[cfg(procmacro2_unstable)]
diff --git a/src/strnom.rs b/src/strnom.rs
index 5f23803..2f9e73f 100644
--- a/src/strnom.rs
+++ b/src/strnom.rs
@@ -14,10 +14,16 @@
}
impl<'a> Cursor<'a> {
+ #[cfg(not(procmacro2_unstable))]
pub fn advance(&self, amt: usize) -> Cursor<'a> {
Cursor {
rest: &self.rest[amt..],
- #[cfg(procmacro2_unstable)]
+ }
+ }
+ #[cfg(procmacro2_unstable)]
+ pub fn advance(&self, amt: usize) -> Cursor<'a> {
+ Cursor {
+ rest: &self.rest[amt..],
off: self.off + (amt as u32),
}
}
diff --git a/tests/test.rs b/tests/test.rs
index 2de120a..6442ba6 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -1,6 +1,13 @@
extern crate proc_macro2;
-use proc_macro2::{Term, Literal, TokenStream, TokenNode, Span};
+use proc_macro2::{Term, Literal, TokenStream};
+
+#[cfg(procmacro2_unstable)]
+use proc_macro2::TokenNode;
+
+#[cfg(procmacro2_unstable)]
+#[cfg(not(feature = "unstable"))]
+use proc_macro2::Span;
#[test]
fn symbols() {