Work around when built as a dependency in docs.rs
Our build script has:
if cfg!(procmacro2_semver_exempt) {
println!("cargo:rustc-cfg=super_unstable");
}
But when proc-macro2 is built as a dependency of another crate in docs.rs, we
are seeing the builder invoke rustc with `--cfg super_unstable` but without
`--cfg procmacro2_semver_exempt`. The super_unstable flag is only set on that
one line, so procmacro2_semver_exempt should have also been set. Hopefully this
change will result in both flags being passed.
We will need to figure out how to set unstable flags only when building our own
docs.rs docs, not when building proc-macro2 as a dependency of a different
crate.
diff --git a/build.rs b/build.rs
index 3379da3..784c59c 100644
--- a/build.rs
+++ b/build.rs
@@ -27,6 +27,8 @@
if cfg!(procmacro2_semver_exempt) {
println!("cargo:rustc-cfg=super_unstable");
+ // https://github.com/alexcrichton/proc-macro2/issues/147
+ println!("cargo:rustc-cfg=procmacro2_semver_exempt");
}
}