Update to quote 0.4
diff --git a/src/expr.rs b/src/expr.rs
index 3f18fa4..a7c8c33 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -639,7 +639,7 @@
assert!(index < std::u32::MAX as usize);
Index {
index: index as u32,
- span: Span::default(),
+ span: Span::def_site(),
}
}
}
diff --git a/src/ident.rs b/src/ident.rs
index af58263..4c897a6 100644
--- a/src/ident.rs
+++ b/src/ident.rs
@@ -146,7 +146,7 @@
impl<'a> From<&'a str> for Ident {
fn from(s: &str) -> Self {
- Ident::new(s, Span::default())
+ Ident::new(s, Span::def_site())
}
}
@@ -176,13 +176,13 @@
impl<'a> From<Cow<'a, str>> for Ident {
fn from(s: Cow<'a, str>) -> Self {
- Ident::new(&s, Span::default())
+ Ident::new(&s, Span::def_site())
}
}
impl From<String> for Ident {
fn from(s: String) -> Self {
- Ident::new(&s, Span::default())
+ Ident::new(&s, Span::def_site())
}
}
diff --git a/src/spanned.rs b/src/spanned.rs
index c844fc7..84c50d5 100644
--- a/src/spanned.rs
+++ b/src/spanned.rs
@@ -107,7 +107,7 @@
/// Returns a `Span` covering the complete contents of this syntax tree
/// node, or [`Span::call_site()`] if this node is empty.
///
- /// [`Span::call_site()`]: https://docs.rs/proc-macro2/0.1/proc_macro2/struct.Span.html#method.call_site
+ /// [`Span::call_site()`]: https://docs.rs/proc-macro2/0.2/proc_macro2/struct.Span.html#method.call_site
fn span(&self) -> Span;
}
diff --git a/src/token.rs b/src/token.rs
index 685fcd1..f05968b 100644
--- a/src/token.rs
+++ b/src/token.rs
@@ -120,7 +120,6 @@
macro_rules! token_punct {
(#[$doc:meta] $s:tt pub struct $name:ident/$len:tt) => {
#[cfg_attr(feature = "clone-impls", derive(Copy, Clone))]
- #[derive(Default)]
#[$doc]
///
/// Don't try to remember the name of this type -- use the [`Token!`]
@@ -135,6 +134,12 @@
}
}
+ impl ::std::default::Default for $name {
+ fn default() -> Self {
+ $name([Span::def_site(); $len])
+ }
+ }
+
#[cfg(feature = "extra-traits")]
impl ::std::fmt::Debug for $name {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
@@ -182,7 +187,6 @@
macro_rules! token_keyword {
(#[$doc:meta] $s:tt pub struct $name:ident) => {
#[cfg_attr(feature = "clone-impls", derive(Copy, Clone))]
- #[derive(Default)]
#[$doc]
///
/// Don't try to remember the name of this type -- use the [`Token!`]
@@ -191,6 +195,12 @@
/// [`Token!`]: index.html
pub struct $name(pub Span);
+ impl ::std::default::Default for $name {
+ fn default() -> Self {
+ $name(Span::def_site())
+ }
+ }
+
#[cfg(feature = "extra-traits")]
impl ::std::fmt::Debug for $name {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
@@ -238,10 +248,15 @@
macro_rules! token_delimiter {
(#[$doc:meta] $s:tt pub struct $name:ident) => {
#[cfg_attr(feature = "clone-impls", derive(Copy, Clone))]
- #[derive(Default)]
#[$doc]
pub struct $name(pub Span);
+ impl ::std::default::Default for $name {
+ fn default() -> Self {
+ $name(Span::def_site())
+ }
+ }
+
#[cfg(feature = "extra-traits")]
impl ::std::fmt::Debug for $name {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
@@ -630,7 +645,7 @@
where
T: FromSpans,
{
- let mut spans = [Span::default(); 3];
+ let mut spans = [Span::def_site(); 3];
assert!(s.len() <= spans.len());
let chars = s.chars();