Make doc examples compatible with stable
diff --git a/src/attr.rs b/src/attr.rs
index 595f12a..4fede88 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -76,9 +76,10 @@
     /// [`Attribute::parse_inner`]: #method.parse_inner
     ///
     /// ```
-    /// # extern crate syn;
-    /// #
-    /// use syn::{Attribute, Ident, Token};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::{Attribute, Ident};
     /// use syn::parse::{Parse, ParseStream, Result};
     ///
     /// // Parses a unit struct with attributes.
diff --git a/src/error.rs b/src/error.rs
index 05826c4..712b9b7 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -45,9 +45,10 @@
     /// # Example
     ///
     /// ```
-    /// # extern crate syn;
-    /// #
-    /// use syn::{Ident, LitStr, Token};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::{Ident, LitStr};
     /// use syn::parse::{Error, ParseStream, Result};
     ///
     /// // Parses input that looks like `name = "string"` where the key must be
diff --git a/src/expr.rs b/src/expr.rs
index 4a39367..d4b689a 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -2349,9 +2349,10 @@
         /// # Example
         ///
         /// ```
-        /// # extern crate syn;
-        /// #
-        /// use syn::{braced, token, Attribute, Block, Ident, Stmt, Token};
+        /// #[macro_use]
+        /// extern crate syn;
+        ///
+        /// use syn::{token, Attribute, Block, Ident, Stmt};
         /// use syn::parse::{Parse, ParseStream, Result};
         ///
         /// // Parse a function with no generics or parameter list.
diff --git a/src/ext.rs b/src/ext.rs
index 0a412e4..ae6c2ae 100644
--- a/src/ext.rs
+++ b/src/ext.rs
@@ -18,9 +18,10 @@
     /// identifiers.
     ///
     /// ```rust
-    /// # extern crate syn;
-    /// #
-    /// use syn::{Ident, Token};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::Ident;
     /// use syn::ext::IdentExt;
     /// use syn::parse::{Error, ParseStream, Result};
     ///
diff --git a/src/generics.rs b/src/generics.rs
index c63cb69..51c6080 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -301,12 +301,13 @@
     /// for that type.
     ///
     /// ```
-    /// # extern crate proc_macro2;
-    /// # extern crate syn;
+    /// # #[macro_use]
     /// # extern crate quote;
     /// #
+    /// # extern crate proc_macro2;
+    /// # extern crate syn;
+    /// #
     /// # use proc_macro2::{Span, Ident};
-    /// # use quote::quote;
     /// #
     /// # fn main() {
     /// #     let generics: syn::Generics = Default::default();
diff --git a/src/group.rs b/src/group.rs
index b2e4659..84a19fd 100644
--- a/src/group.rs
+++ b/src/group.rs
@@ -95,12 +95,13 @@
 /// # Example
 ///
 /// ```rust
+/// # #[macro_use]
 /// # extern crate quote;
-/// # extern crate syn;
 /// #
-/// # use quote::quote;
-/// #
-/// use syn::{parenthesized, token, Ident, Token, Type};
+/// #[macro_use]
+/// extern crate syn;
+///
+/// use syn::{token, Ident, Type};
 /// use syn::parse::{Parse, ParseStream, Result};
 /// use syn::punctuated::Punctuated;
 ///
@@ -155,12 +156,12 @@
 /// # Example
 ///
 /// ```rust
+/// # #[macro_use]
 /// # extern crate quote;
-/// # extern crate syn;
 /// #
-/// # use quote::quote;
-/// #
-/// use syn::{braced, token, Ident, Token, Type};
+/// #[macro_use]
+/// extern crate syn;
+/// use syn::{token, Ident, Type};
 /// use syn::parse::{Parse, ParseStream, Result};
 /// use syn::punctuated::Punctuated;
 ///
@@ -236,14 +237,16 @@
 /// # Example
 ///
 /// ```rust
-/// # extern crate proc_macro2;
+/// # #[macro_use]
 /// # extern crate quote;
-/// # extern crate syn;
 /// #
-/// # use quote::quote;
-/// #
+/// #[macro_use]
+/// extern crate syn;
+///
+/// extern crate proc_macro2;
+///
 /// use proc_macro2::TokenStream;
-/// use syn::{bracketed, token, Token};
+/// use syn::token;
 /// use syn::parse::{Parse, ParseStream, Result};
 ///
 /// // Parse an outer attribute like:
diff --git a/src/keyword.rs b/src/keyword.rs
index 8fcb711..019ada9 100644
--- a/src/keyword.rs
+++ b/src/keyword.rs
@@ -8,12 +8,14 @@
 /// prefix.
 ///
 /// ```
+/// # #[macro_use]
 /// # extern crate syn;
 /// #
 /// mod kw {
-///     # use syn;
-///     syn::custom_keyword!(whatever);
+///     custom_keyword!(whatever);
 /// }
+/// #
+/// # fn main() {}
 /// ```
 ///
 /// The generated syntax tree node supports the following operations just like
@@ -47,15 +49,15 @@
 /// by crates that need to use them as such.
 ///
 /// ```
-/// # extern crate syn;
-/// #
-/// use syn::{LitBool, LitStr, Token};
+/// #[macro_use]
+/// extern crate syn;
+///
+/// use syn::{LitBool, LitStr};
 /// use syn::parse::{Parse, ParseStream, Result};
 ///
 /// mod kw {
-///     # use syn;
-///     syn::custom_keyword!(bool);
-///     syn::custom_keyword!(str);
+///     custom_keyword!(bool);
+///     custom_keyword!(str);
 /// }
 ///
 /// enum Argument {
diff --git a/src/lib.rs b/src/lib.rs
index be9a6a8..2fdec09 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -73,13 +73,15 @@
 //! ```
 //!
 //! ```rust
-//! # extern crate proc_macro;
-//! # extern crate quote;
-//! # extern crate syn;
-//! #
+//! #[macro_use]
+//! extern crate quote;
+//! #[macro_use]
+//! extern crate syn;
+//!
+//! extern crate proc_macro;
+//!
 //! use proc_macro::TokenStream;
-//! use quote::quote;
-//! use syn::{parse_macro_input, DeriveInput};
+//! use syn::DeriveInput;
 //!
 //! # const IGNORE_TOKENS: &str = stringify! {
 //! #[proc_macro_derive(MyMacro)]
@@ -615,12 +617,13 @@
 /// # Examples
 ///
 /// ```rust
-/// # extern crate proc_macro;
-/// # extern crate quote;
-/// # extern crate syn;
-/// #
+/// #[macro_use]
+/// extern crate quote;
+///
+/// extern crate proc_macro;
+/// extern crate syn;
+///
 /// use proc_macro::TokenStream;
-/// use quote::quote;
 /// use syn::DeriveInput;
 ///
 /// # const IGNORE_TOKENS: &str = stringify! {
@@ -771,11 +774,12 @@
 /// # Intended usage
 ///
 /// ```rust
-/// # extern crate proc_macro;
-/// # extern crate syn;
-/// #
+/// #[macro_use]
+/// extern crate syn;
+///
+/// extern crate proc_macro;
+///
 /// use proc_macro::TokenStream;
-/// use syn::parse_macro_input;
 /// use syn::parse::{Parse, ParseStream, Result};
 ///
 /// struct MyMacroInput {
diff --git a/src/lookahead.rs b/src/lookahead.rs
index 1f2b223..be38a71 100644
--- a/src/lookahead.rs
+++ b/src/lookahead.rs
@@ -22,9 +22,10 @@
 /// # Example
 ///
 /// ```
-/// # extern crate syn;
-/// #
-/// use syn::{ConstParam, Ident, Lifetime, LifetimeDef, Token, TypeParam};
+/// #[macro_use]
+/// extern crate syn;
+///
+/// use syn::{ConstParam, Ident, Lifetime, LifetimeDef, TypeParam};
 /// use syn::parse::{Parse, ParseStream, Result};
 ///
 /// // A generic parameter, a single one of the comma-separated elements inside
diff --git a/src/parse.rs b/src/parse.rs
index a106de5..c36d8b1 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -34,11 +34,13 @@
 //! [`parse_macro_input!`]: ../macro.parse_macro_input.html
 //!
 //! ```
-//! # extern crate proc_macro;
-//! # extern crate syn;
-//! #
+//! #[macro_use]
+//! extern crate syn;
+//!
+//! extern crate proc_macro;
+//!
 //! use proc_macro::TokenStream;
-//! use syn::{braced, parse_macro_input, token, Field, Ident, Token};
+//! use syn::{token, Field, Ident};
 //! use syn::parse::{Parse, ParseStream, Result};
 //! use syn::punctuated::Punctuated;
 //!
@@ -156,14 +158,15 @@
 //! [`Parser`]: trait.Parser.html
 //!
 //! ```
-//! # extern crate syn;
-//! #
-//! # extern crate proc_macro2;
-//! # use proc_macro2::TokenStream;
-//! #
+//! #[macro_use]
+//! extern crate syn;
+//!
+//! extern crate proc_macro2;
+//!
+//! use proc_macro2::TokenStream;
 //! use syn::parse::Parser;
 //! use syn::punctuated::Punctuated;
-//! use syn::{Attribute, Expr, PathSegment, Token};
+//! use syn::{Attribute, Expr, PathSegment};
 //!
 //! # fn run_parsers() -> Result<(), syn::parse::Error> {
 //! #     let tokens = TokenStream::new().into();
@@ -396,9 +399,10 @@
     /// [`Attribute::parse_outer`]: ../struct.Attribute.html#method.parse_outer
     ///
     /// ```
-    /// # extern crate syn;
-    /// #
-    /// use syn::{Attribute, Ident, Token};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::{Attribute, Ident};
     /// use syn::parse::{Parse, ParseStream, Result};
     ///
     /// // Parses a unit struct with attributes.
@@ -451,9 +455,10 @@
     /// token in the input is either `where` or an opening curly brace.
     ///
     /// ```
-    /// # extern crate syn;
-    /// #
-    /// use syn::{braced, token, Generics, Ident, Token, TypeParamBound};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::{token, Generics, Ident, TypeParamBound};
     /// use syn::parse::{Parse, ParseStream, Result};
     /// use syn::punctuated::Punctuated;
     ///
@@ -522,9 +527,10 @@
     /// }`. In other words `union` is a contextual keyword.
     ///
     /// ```
-    /// # extern crate syn;
-    /// #
-    /// use syn::{Ident, ItemUnion, Macro, Token};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::{Ident, ItemUnion, Macro};
     /// use syn::parse::{Parse, ParseStream, Result};
     ///
     /// // Parses either a union or a macro invocation.
@@ -567,12 +573,13 @@
     /// # Example
     ///
     /// ```rust
+    /// # #[macro_use]
     /// # extern crate quote;
-    /// # extern crate syn;
     /// #
-    /// # use quote::quote;
-    /// #
-    /// use syn::{parenthesized, token, Ident, Token, Type};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::{token, Ident, Type};
     /// use syn::parse::{Parse, ParseStream, Result};
     /// use syn::punctuated::Punctuated;
     ///
@@ -622,9 +629,10 @@
     /// # Example
     ///
     /// ```rust
-    /// # extern crate syn;
-    /// #
-    /// use syn::{braced, token, Ident, Item, Token};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::{token, Ident, Item};
     /// use syn::parse::{Parse, ParseStream, Result};
     ///
     /// // Parses a Rust `mod m { ... }` containing zero or more items.
@@ -664,9 +672,10 @@
     /// # Example
     ///
     /// ```
-    /// # extern crate syn;
-    /// #
-    /// use syn::{ConstParam, Ident, Lifetime, LifetimeDef, Token, TypeParam};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::{ConstParam, Ident, Lifetime, LifetimeDef, TypeParam};
     /// use syn::parse::{Parse, ParseStream, Result};
     ///
     /// // A generic parameter, a single one of the comma-separated elements inside
@@ -772,9 +781,10 @@
     /// work performed against the forked parse stream.
     ///
     /// ```
-    /// # extern crate syn;
-    /// #
-    /// use syn::{parenthesized, token, Ident, Path, Token};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::{token, Ident, Path};
     /// use syn::ext::IdentExt;
     /// use syn::parse::{Parse, ParseStream, Result};
     ///
@@ -847,9 +857,10 @@
     /// # Example
     ///
     /// ```
-    /// # extern crate syn;
-    /// #
-    /// use syn::{Expr, Token};
+    /// #[macro_use]
+    /// extern crate syn;
+    ///
+    /// use syn::Expr;
     /// use syn::parse::{Parse, ParseStream, Result};
     ///
     /// // Some kind of loop: `while` or `for` or `loop`.
@@ -871,6 +882,8 @@
     ///         }
     ///     }
     /// }
+    /// #
+    /// # fn main() {}
     /// ```
     pub fn error<T: Display>(&self, message: T) -> Error {
         error::new_at(self.scope, self.cursor(), message)
diff --git a/src/parse_quote.rs b/src/parse_quote.rs
index d354be6..e7c3dfe 100644
--- a/src/parse_quote.rs
+++ b/src/parse_quote.rs
@@ -9,11 +9,12 @@
 /// [`Parse`]: parse/trait.Parse.html
 ///
 /// ```
-/// # extern crate syn;
-/// # extern crate quote;
-/// #
-/// use quote::quote;
-/// use syn::{parse_quote, Stmt};
+/// #[macro_use]
+/// extern crate quote;
+/// #[macro_use]
+/// extern crate syn;
+///
+/// use syn::Stmt;
 ///
 /// fn main() {
 ///     let name = quote!(v);
@@ -37,12 +38,11 @@
 /// parameter `T` in the input generics.
 ///
 /// ```
-/// # extern crate quote;
-/// # extern crate syn;
-/// #
-/// # use quote::quote;
-/// # use syn::parse_quote;
-/// #
+/// #[macro_use]
+/// extern crate quote;
+/// #[macro_use]
+/// extern crate syn;
+///
 /// use syn::{Generics, GenericParam};
 ///
 /// // Add a bound `T: HeapSize` to every type parameter T.
diff --git a/src/path.rs b/src/path.rs
index 693d71c..301a06b 100644
--- a/src/path.rs
+++ b/src/path.rs
@@ -360,9 +360,10 @@
         /// # Example
         ///
         /// ```
-        /// # extern crate syn;
-        /// #
-        /// use syn::{Path, Token};
+        /// #[macro_use]
+        /// extern crate syn;
+        ///
+        /// use syn::Path;
         /// use syn::parse::{Parse, ParseStream, Result};
         ///
         /// // A simplified single `use` statement like:
diff --git a/src/spanned.rs b/src/spanned.rs
index 6dd50cb..2eac86a 100644
--- a/src/spanned.rs
+++ b/src/spanned.rs
@@ -31,12 +31,13 @@
 //! ```
 //! # extern crate proc_macro;
 //! # extern crate proc_macro2;
-//! # extern crate quote;
 //! # extern crate syn;
 //! #
+//! #[macro_use]
+//! extern crate quote;
+//!
 //! use proc_macro::TokenStream;
 //! use proc_macro2::Span;
-//! use quote::quote_spanned;
 //! use syn::Type;
 //! use syn::spanned::Spanned;
 //!
diff --git a/src/token.rs b/src/token.rs
index 8892c33..40aa74f 100644
--- a/src/token.rs
+++ b/src/token.rs
@@ -21,9 +21,10 @@
 //! [`ItemStatic`]: ../struct.ItemStatic.html
 //!
 //! ```
+//! # #[macro_use]
 //! # extern crate syn;
 //! #
-//! # use syn::{Attribute, Expr, Ident, Token, Type, Visibility};
+//! # use syn::{Attribute, Expr, Ident, Type, Visibility};
 //! #
 //! pub struct ItemStatic {
 //!     pub attrs: Vec<Attribute>,