Set all documentation examples to 2018 edition
diff --git a/src/attr.rs b/src/attr.rs
index da12047..d1e7dca 100644
--- a/src/attr.rs
+++ b/src/attr.rs
@@ -69,7 +69,7 @@
/// [`Attribute::parse_outer`]: #method.parse_outer
/// [`Attribute::parse_inner`]: #method.parse_inner
///
- /// ```
+ /// ```edition2018
/// use syn::{Attribute, Ident, Result, Token};
/// use syn::parse::{Parse, ParseStream};
///
@@ -470,7 +470,7 @@
/// For example if we are developing an attribute macro that is intended to be
/// invoked on function items as follows:
///
-/// ```rust
+/// ```edition2018
/// # const IGNORE: &str = stringify! {
/// #[my_attribute(path = "/v1/refresh")]
/// # };
@@ -482,7 +482,7 @@
/// The implementation of this macro would want to parse its attribute arguments
/// as type `AttributeArgs`.
///
-/// ```rust
+/// ```edition2018
/// extern crate proc_macro;
///
/// use proc_macro::TokenStream;
diff --git a/src/error.rs b/src/error.rs
index e3bc304..6a1a200 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -51,7 +51,7 @@
///
/// # Example
///
- /// ```
+ /// ```edition2018
/// use syn::{Error, Ident, LitStr, Result, Token};
/// use syn::parse::ParseStream;
///
diff --git a/src/expr.rs b/src/expr.rs
index d07070f..fe067cb 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -19,7 +19,7 @@
/// This type is a syntax tree enum. In Syn this and other syntax tree enums
/// are designed to be traversed using the following rebinding idiom.
///
- /// ```
+ /// ```edition2018
/// # use syn::Expr;
/// #
/// # fn example(expr: Expr) {
@@ -52,7 +52,7 @@
///
/// The pattern is similar if the input expression is borrowed:
///
- /// ```
+ /// ```edition2018
/// # use syn::Expr;
/// #
/// # fn example(expr: &Expr) {
@@ -66,7 +66,7 @@
///
/// This approach avoids repeating the variant names twice on every line.
///
- /// ```
+ /// ```edition2018
/// # use syn::{Expr, ExprMethodCall};
/// #
/// # fn example(expr: Expr) {
@@ -81,7 +81,7 @@
/// In general, the name to which a syntax tree enum variant is bound should
/// be a suitable name for the complete syntax tree enum type.
///
- /// ```
+ /// ```edition2018
/// # use syn::{Expr, ExprField};
/// #
/// # fn example(discriminant: &ExprField) {
@@ -911,7 +911,7 @@
///
/// As in:
///
- /// ```rust
+ /// ```edition2018
/// # fn f() -> bool {
/// # let n = 0;
/// match n {
@@ -2291,7 +2291,7 @@
///
/// # Example
///
- /// ```
+ /// ```edition2018
/// use syn::{braced, token, Attribute, Block, Ident, Result, Stmt, Token};
/// use syn::parse::{Parse, ParseStream};
///
diff --git a/src/ext.rs b/src/ext.rs
index 38c7a2c..ca6d70d 100644
--- a/src/ext.rs
+++ b/src/ext.rs
@@ -17,7 +17,7 @@
/// This is useful when parsing a DSL which allows Rust keywords as
/// identifiers.
///
- /// ```rust
+ /// ```edition2018
/// use syn::{Error, Ident, Result, Token};
/// use syn::ext::IdentExt;
/// use syn::parse::ParseStream;
diff --git a/src/file.rs b/src/file.rs
index caa1565..30defe7 100644
--- a/src/file.rs
+++ b/src/file.rs
@@ -10,7 +10,7 @@
/// Parse a Rust source file into a `syn::File` and print out a debug
/// representation of the syntax tree.
///
- /// ```
+ /// ```edition2018
/// use std::env;
/// use std::fs::File;
/// use std::io::Read;
diff --git a/src/generics.rs b/src/generics.rs
index 8119385..898a333 100644
--- a/src/generics.rs
+++ b/src/generics.rs
@@ -292,7 +292,7 @@
/// Split a type's generics into the pieces required for impl'ing a trait
/// for that type.
///
- /// ```
+ /// ```edition2018
/// # extern crate proc_macro2;
/// # extern crate quote;
/// #
diff --git a/src/group.rs b/src/group.rs
index d2cbd3e..5982a8f 100644
--- a/src/group.rs
+++ b/src/group.rs
@@ -94,7 +94,7 @@
///
/// # Example
///
-/// ```rust
+/// ```edition2018
/// # extern crate quote;
/// # use quote::quote;
/// #
@@ -152,7 +152,7 @@
///
/// # Example
///
-/// ```rust
+/// ```edition2018
/// # extern crate quote;
/// # use quote::quote;
/// #
@@ -231,7 +231,7 @@
///
/// # Example
///
-/// ```rust
+/// ```edition2018
/// # extern crate proc_macro2;
/// # extern crate quote;
/// #
diff --git a/src/keyword.rs b/src/keyword.rs
index 54aba98..baebc70 100644
--- a/src/keyword.rs
+++ b/src/keyword.rs
@@ -7,7 +7,7 @@
/// module called `kw` or `keyword` and that the resulting parser be invoked
/// with a `kw::` or `keyword::` prefix.
///
-/// ```
+/// ```edition2018
/// mod kw {
/// syn::custom_keyword!(whatever);
/// }
@@ -43,7 +43,7 @@
/// identifier that is not a keyword, these can be declared as custom keywords
/// by crates that need to use them as such.
///
-/// ```
+/// ```edition2018
/// use syn::{LitBool, LitStr, Result, Token};
/// use syn::parse::{Parse, ParseStream};
///
diff --git a/src/lib.rs b/src/lib.rs
index ff43d3e..b4590dd 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -64,7 +64,7 @@
//! proc-macro = true
//! ```
//!
-//! ```rust
+//! ```edition2018
//! # extern crate quote;
//! #
//! extern crate proc_macro;
@@ -97,7 +97,7 @@
//!
//! [`heapsize`]: https://github.com/dtolnay/syn/tree/master/examples/heapsize
//!
-//! ```rust
+//! ```edition2018
//! pub trait HeapSize {
//! /// Total number of bytes of heap memory owned by `self`.
//! fn heap_size_of_children(&self) -> usize;
@@ -107,7 +107,7 @@
//! The custom derive allows users to write `#[derive(HeapSize)]` on data
//! structures in their program.
//!
-//! ```rust
+//! ```edition2018
//! # const IGNORE_TOKENS: &str = stringify! {
//! #[derive(HeapSize)]
//! # };
@@ -125,7 +125,7 @@
//! compiler's error messages are displayed in user code. Consider the error the
//! user sees if one of their field types does not implement `HeapSize`.
//!
-//! ```rust
+//! ```edition2018
//! # const IGNORE_TOKENS: &str = stringify! {
//! #[derive(HeapSize)]
//! # };
@@ -159,7 +159,7 @@
//! The example reimplements the popular `lazy_static` crate from crates.io as a
//! procedural macro.
//!
-//! ```
+//! ```edition2018
//! # macro_rules! lazy_static {
//! # ($($tt:tt)*) => {}
//! # }
@@ -429,7 +429,7 @@
///
/// [`Visit`]: trait.Visit.html
///
- /// ```rust
+ /// ```edition2018
/// # use syn::{Attribute, BinOp, Expr, ExprBinary};
/// #
/// pub trait Visit<'ast> {
@@ -465,7 +465,7 @@
///
/// [`VisitMut`]: trait.VisitMut.html
///
- /// ```rust
+ /// ```edition2018
/// # use syn::{Attribute, BinOp, Expr, ExprBinary};
/// #
/// pub trait VisitMut {
@@ -501,7 +501,7 @@
///
/// [`Fold`]: trait.Fold.html
///
- /// ```rust
+ /// ```edition2018
/// # use syn::{Attribute, BinOp, Expr, ExprBinary};
/// #
/// pub trait Fold {
@@ -584,7 +584,7 @@
///
/// # Examples
///
-/// ```rust
+/// ```edition2018
/// # extern crate quote;
/// #
/// extern crate proc_macro;
@@ -646,7 +646,7 @@
///
/// # Examples
///
-/// ```rust
+/// ```edition2018
/// use syn::{Expr, Result};
///
/// fn run() -> Result<()> {
@@ -680,7 +680,7 @@
///
/// # Examples
///
-/// ```rust,no_run
+/// ```edition2018,no_run
/// use std::error::Error;
/// use std::fs::File;
/// use std::io::Read;
diff --git a/src/lifetime.rs b/src/lifetime.rs
index 9572a61..26f9bac 100644
--- a/src/lifetime.rs
+++ b/src/lifetime.rs
@@ -35,7 +35,7 @@
///
/// # Invocation
///
- /// ```
+ /// ```edition2018
/// # extern crate proc_macro2;
/// #
/// # use proc_macro2::Span;
diff --git a/src/lit.rs b/src/lit.rs
index 9fd87e8..aeff935 100644
--- a/src/lit.rs
+++ b/src/lit.rs
@@ -121,7 +121,7 @@
///
/// # Example
///
- /// ```
+ /// ```edition2018
/// # extern crate proc_macro2;
/// #
/// use proc_macro2::Span;
diff --git a/src/lookahead.rs b/src/lookahead.rs
index 10cd023..91d55f1 100644
--- a/src/lookahead.rs
+++ b/src/lookahead.rs
@@ -21,7 +21,7 @@
///
/// # Example
///
-/// ```
+/// ```edition2018
/// use syn::{ConstParam, Ident, Lifetime, LifetimeDef, Result, Token, TypeParam};
/// use syn::parse::{Parse, ParseStream};
///
diff --git a/src/parse.rs b/src/parse.rs
index 03513c8..1b7e947 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -25,7 +25,7 @@
//!
//! [`parse_macro_input!`]: ../macro.parse_macro_input.html
//!
-//! ```
+//! ```edition2018
//! extern crate proc_macro;
//!
//! use proc_macro::TokenStream;
@@ -101,7 +101,7 @@
//! [`syn::parse_str`]: ../fn.parse_str.html
//! [`Parse`]: trait.Parse.html
//!
-//! ```
+//! ```edition2018
//! use syn::Type;
//!
//! # fn run_parser() -> syn::Result<()> {
@@ -132,7 +132,7 @@
//! The `Parse` trait is not implemented in these cases because there is no good
//! behavior to consider the default.
//!
-//! ```compile_fail
+//! ```edition2018,compile_fail
//! # extern crate proc_macro;
//! #
//! # use syn::punctuated::Punctuated;
@@ -154,7 +154,7 @@
//!
//! [`Parser`]: trait.Parser.html
//!
-//! ```
+//! ```edition2018
//! extern crate proc_macro;
//!
//! use proc_macro::TokenStream;
@@ -293,7 +293,7 @@
///
/// # Example
///
-/// ```
+/// ```edition2018
/// # extern crate proc_macro2;
/// #
/// use proc_macro2::TokenTree;
@@ -429,7 +429,7 @@
///
/// [`Attribute::parse_outer`]: ../struct.Attribute.html#method.parse_outer
///
- /// ```
+ /// ```edition2018
/// use syn::{Attribute, Ident, Result, Token};
/// use syn::parse::{Parse, ParseStream};
///
@@ -480,7 +480,7 @@
/// In this example we finish parsing the list of supertraits when the next
/// token in the input is either `where` or an opening curly brace.
///
- /// ```
+ /// ```edition2018
/// use syn::{braced, token, Generics, Ident, Result, Token, TypeParamBound};
/// use syn::parse::{Parse, ParseStream};
/// use syn::punctuated::Punctuated;
@@ -547,7 +547,7 @@
/// union` and a macro invocation that looks like `union::some_macro! { ...
/// }`. In other words `union` is a contextual keyword.
///
- /// ```
+ /// ```edition2018
/// use syn::{Ident, ItemUnion, Macro, Result, Token};
/// use syn::parse::{Parse, ParseStream};
///
@@ -588,7 +588,7 @@
///
/// # Example
///
- /// ```rust
+ /// ```edition2018
/// # extern crate quote;
/// # use quote::quote;
/// #
@@ -641,7 +641,7 @@
///
/// # Example
///
- /// ```rust
+ /// ```edition2018
/// use syn::{braced, token, Ident, Item, Result, Token};
/// use syn::parse::{Parse, ParseStream};
///
@@ -680,7 +680,7 @@
///
/// # Example
///
- /// ```
+ /// ```edition2018
/// use syn::{ConstParam, Ident, Lifetime, LifetimeDef, Result, Token, TypeParam};
/// use syn::parse::{Parse, ParseStream};
///
@@ -730,7 +730,7 @@
/// is if your macro ends up parsing a large amount of content more than
/// once.
///
- /// ```
+ /// ```edition2018
/// # use syn::{Expr, Result};
/// # use syn::parse::ParseStream;
/// #
@@ -767,7 +767,7 @@
/// needs to distinguish parentheses that specify visibility restrictions
/// from parentheses that form part of a tuple type.
///
- /// ```
+ /// ```edition2018
/// # struct A;
/// # struct B;
/// # struct C;
@@ -784,7 +784,7 @@
/// parentheses after the `pub` keyword. This is a small bounded amount of
/// work performed against the forked parse stream.
///
- /// ```
+ /// ```edition2018
/// use syn::{parenthesized, token, Ident, Path, Result, Token};
/// use syn::ext::IdentExt;
/// use syn::parse::{Parse, ParseStream};
@@ -855,7 +855,7 @@
///
/// # Example
///
- /// ```
+ /// ```edition2018
/// use syn::{Expr, Result, Token};
/// use syn::parse::{Parse, ParseStream};
///
@@ -892,7 +892,7 @@
///
/// # Example
///
- /// ```
+ /// ```edition2018
/// # extern crate proc_macro2;
/// #
/// use proc_macro2::TokenTree;
diff --git a/src/parse_macro_input.rs b/src/parse_macro_input.rs
index e38c711..9d8f6ae 100644
--- a/src/parse_macro_input.rs
+++ b/src/parse_macro_input.rs
@@ -8,7 +8,7 @@
///
/// # Intended usage
///
-/// ```rust
+/// ```edition2018
/// extern crate proc_macro;
///
/// use proc_macro::TokenStream;
diff --git a/src/parse_quote.rs b/src/parse_quote.rs
index 13ba95b..f6356d0 100644
--- a/src/parse_quote.rs
+++ b/src/parse_quote.rs
@@ -8,7 +8,7 @@
///
/// [`Parse`]: parse/trait.Parse.html
///
-/// ```
+/// ```edition2018
/// # extern crate quote;
/// #
/// use quote::quote;
@@ -35,7 +35,7 @@
/// The following helper function adds a bound `T: HeapSize` to every type
/// parameter `T` in the input generics.
///
-/// ```
+/// ```edition2018
/// use syn::{parse_quote, Generics, GenericParam};
///
/// // Add a bound `T: HeapSize` to every type parameter T.
diff --git a/src/path.rs b/src/path.rs
index f35c111..10a043e 100644
--- a/src/path.rs
+++ b/src/path.rs
@@ -358,7 +358,7 @@
///
/// # Example
///
- /// ```
+ /// ```edition2018
/// use syn::{Path, Result, Token};
/// use syn::parse::{Parse, ParseStream};
///
diff --git a/src/spanned.rs b/src/spanned.rs
index a6a2120..06aeef9 100644
--- a/src/spanned.rs
+++ b/src/spanned.rs
@@ -20,7 +20,7 @@
//! The following macro code takes a variable `ty` of type `Type` and produces a
//! static assertion that `Sync` is implemented for that type.
//!
-//! ```
+//! ```edition2018
//! # extern crate proc_macro;
//! # extern crate proc_macro2;
//! # extern crate quote;
diff --git a/src/token.rs b/src/token.rs
index 8dc6e24..f54d02c 100644
--- a/src/token.rs
+++ b/src/token.rs
@@ -12,7 +12,7 @@
//!
//! [`ItemStatic`]: ../struct.ItemStatic.html
//!
-//! ```
+//! ```edition2018
//! # use syn::{Attribute, Expr, Ident, Token, Type, Visibility};
//! #
//! pub struct ItemStatic {
@@ -40,7 +40,7 @@
//! [`bracketed!`]: ../macro.bracketed.html
//! [`braced!`]: ../macro.braced.html
//!
-//! ```
+//! ```edition2018
//! use syn::{Attribute, Result};
//! use syn::parse::{Parse, ParseStream};
//! #