Enable testing of documentation examples
diff --git a/Cargo.toml b/Cargo.toml
index 21d22cf..5527c5d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,9 +15,6 @@
 unstable API.
 """
 
-[lib]
-doctest = false
-
 [package.metadata.docs.rs]
 rustc-args = ["--cfg", "procmacro2_semver_exempt"]
 rustdoc-args = ["--cfg", "procmacro2_semver_exempt"]
@@ -25,6 +22,9 @@
 [dependencies]
 unicode-xid = "0.1"
 
+[dev-dependencies]
+quote = "0.6"
+
 [features]
 # When enabled: act as a shim around the nightly compiler's proc_macro crate.
 # This requires a nightly compiler.
@@ -38,3 +38,11 @@
 
 [badges]
 travis-ci = { repository = "alexcrichton/proc-macro2" }
+
+[patch.crates-io]
+# Our doc tests depend on quote which depends on proc-macro2. Without this line,
+# the proc-macro2 dependency of quote would be the released version of
+# proc-macro2. Quote would implement its traits for types from that proc-macro2,
+# meaning impls would be missing when tested against types from the local
+# proc-macro2.
+proc-macro2 = { path = "." }