diff --git a/build.rs b/build.rs index 178c7575..946be6e2 100644 --- a/build.rs +++ b/build.rs @@ -58,7 +58,8 @@ fn main() { process::exit(1); } - let semver_exempt = cfg!(procmacro2_semver_exempt); + let docs_rs = env::var_os("DOCS_RS").is_some(); + let semver_exempt = cfg!(procmacro2_semver_exempt) || docs_rs; if semver_exempt { // https://github.com/dtolnay/proc-macro2/issues/147 println!("cargo:rustc-cfg=procmacro2_semver_exempt");