Skip to content

Commit

Permalink
Merge pull request #389 from dtolnay/useprocmacro
Browse files Browse the repository at this point in the history
`use_proc_macro` is now equivalent to `feature = "proc-macro"`
  • Loading branch information
dtolnay authored May 25, 2023
2 parents d62d078 + 2993201 commit 13e3756
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
6 changes: 0 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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");
}
Expand Down
4 changes: 2 additions & 2 deletions src/fallback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl Debug for TokenStream {
}
}

#[cfg(use_proc_macro)]
#[cfg(feature = "proc-macro")]
impl From<proc_macro::TokenStream> for TokenStream {
fn from(inner: proc_macro::TokenStream) -> Self {
inner
Expand All @@ -243,7 +243,7 @@ impl From<proc_macro::TokenStream> for TokenStream {
}
}

#[cfg(use_proc_macro)]
#[cfg(feature = "proc-macro")]
impl From<TokenStream> for proc_macro::TokenStream {
fn from(inner: TokenStream) -> Self {
inner
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ compile_error! {"\
build script as well.
"}

#[cfg(use_proc_macro)]
#[cfg(feature = "proc-macro")]
extern crate proc_macro;

mod marker;
Expand Down Expand Up @@ -236,14 +236,14 @@ impl FromStr for TokenStream {
}
}

#[cfg(use_proc_macro)]
#[cfg(feature = "proc-macro")]
impl From<proc_macro::TokenStream> for TokenStream {
fn from(inner: proc_macro::TokenStream) -> Self {
TokenStream::_new(inner.into())
}
}

#[cfg(use_proc_macro)]
#[cfg(feature = "proc-macro")]
impl From<TokenStream> for proc_macro::TokenStream {
fn from(inner: TokenStream) -> Self {
inner.inner.into()
Expand Down

0 comments on commit 13e3756

Please sign in to comment.