Skip to content

Commit

Permalink
Merge pull request #303 from bjorn3/fix_is_available
Browse files Browse the repository at this point in the history
Fix usage of proc_macro::is_available()
  • Loading branch information
dtolnay authored Dec 5, 2021
2 parents 162fff2 + a4beb26 commit 28514c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/detection.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(not(is_available))]
use std::panic::{self, PanicInfo};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Once;
Expand All @@ -24,7 +25,7 @@ pub(crate) fn unforce_fallback() {
initialize();
}

#[cfg(feature = "is_available")]
#[cfg(is_available)]
fn initialize() {
let available = proc_macro::is_available();
WORKS.store(available as usize + 1, Ordering::SeqCst);
Expand Down Expand Up @@ -54,7 +55,7 @@ fn initialize() {
// here. For now, if a user needs to guarantee that this failure mode does
// not occur, they need to call e.g. `proc_macro2::Span::call_site()` from
// the main thread before launching any other threads.
#[cfg(not(feature = "is_available"))]
#[cfg(not(is_available))]
fn initialize() {
type PanicHook = dyn Fn(&PanicInfo) + Sync + Send + 'static;

Expand Down

0 comments on commit 28514c6

Please sign in to comment.