From 2993201fdca8d3c996d59fbd52f0c118e4175b59 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 25 May 2023 14:16:33 -0700 Subject: [PATCH] Use_proc_macro is now equivalent to feature="proc-macro" --- build.rs | 6 ------ src/fallback.rs | 4 ++-- src/lib.rs | 6 +++--- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/build.rs b/build.rs index d7b4b923..199cdff9 100644 --- a/build.rs +++ b/build.rs @@ -1,9 +1,5 @@ // rustc-cfg emitted by the build script: // -// "use_proc_macro" -// Link to extern crate proc_macro. Requires "proc-macro" Cargo cfg to be -// enabled (default is enabled). -// // "wrap_proc_macro" // Wrap types from libproc_macro rather than polyfilling the whole API. // Enabled on rustc 1.29+ as long as procmacro2_semver_exempt is not set, @@ -111,8 +107,6 @@ fn main() { return; } - println!("cargo:rustc-cfg=use_proc_macro"); - if version.nightly || !semver_exempt { println!("cargo:rustc-cfg=wrap_proc_macro"); } diff --git a/src/fallback.rs b/src/fallback.rs index bbea473d..6f50e994 100644 --- a/src/fallback.rs +++ b/src/fallback.rs @@ -233,7 +233,7 @@ impl Debug for TokenStream { } } -#[cfg(use_proc_macro)] +#[cfg(feature = "proc-macro")] impl From for TokenStream { fn from(inner: proc_macro::TokenStream) -> Self { inner @@ -243,7 +243,7 @@ impl From for TokenStream { } } -#[cfg(use_proc_macro)] +#[cfg(feature = "proc-macro")] impl From for proc_macro::TokenStream { fn from(inner: TokenStream) -> Self { inner diff --git a/src/lib.rs b/src/lib.rs index 425bfc4a..9485f769 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -120,7 +120,7 @@ compile_error! {"\ build script as well. "} -#[cfg(use_proc_macro)] +#[cfg(feature = "proc-macro")] extern crate proc_macro; mod marker; @@ -236,14 +236,14 @@ impl FromStr for TokenStream { } } -#[cfg(use_proc_macro)] +#[cfg(feature = "proc-macro")] impl From for TokenStream { fn from(inner: proc_macro::TokenStream) -> Self { TokenStream::_new(inner.into()) } } -#[cfg(use_proc_macro)] +#[cfg(feature = "proc-macro")] impl From for proc_macro::TokenStream { fn from(inner: TokenStream) -> Self { inner.inner.into()