Work around Ident::peek_any on old compilers
diff --git a/src/attr.rs b/src/attr.rs
index 116af8d..da9c121 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -602,7 +602,7 @@
fn parse(input: ParseStream) -> Result<Self> {
if input.peek(Lit) && !(input.peek(LitBool) && input.peek2(Token![=])) {
input.parse().map(NestedMeta::Literal)
- } else if input.peek(Ident::peek_any) {
+ } else if private::peek_any_ident(input) {
input.parse().map(NestedMeta::Meta)
} else {
Err(input.error("expected identifier or literal"))
diff --git a/src/ident.rs b/src/ident.rs
index 63898c6..ace743b 100644
--- a/src/ident.rs
+++ b/src/ident.rs
@@ -1,7 +1,7 @@
#[cfg(feature = "parsing")]
use buffer::Cursor;
#[cfg(feature = "parsing")]
-use lookahead;
+use {lookahead, private};
#[cfg(feature = "parsing")]
use parse::{Parse, ParseStream, Result};
#[cfg(feature = "parsing")]
@@ -84,3 +84,17 @@
Ident::new("_", token.span)
}
}
+
+#[cfg(feature = "parsing")]
+impl private {
+ #[cfg(syn_can_use_associated_constants)]
+ pub fn peek_any_ident(input: ParseStream) -> bool {
+ use ext::IdentExt;
+ input.peek(Ident::peek_any)
+ }
+
+ #[cfg(not(syn_can_use_associated_constants))]
+ pub fn peek_any_ident(input: ParseStream) -> bool {
+ input.cursor().ident().is_some()
+ }
+}