xref: /linux/rust/proc-macro2/marker.rs (revision 784faa8eca8270671e0ed6d9d21f04bbb80fc5f7)
1 // SPDX-License-Identifier: Apache-2.0 OR MIT
2 
3 use alloc::rc::Rc;
4 use core::marker::PhantomData;
5 use core::panic::{RefUnwindSafe, UnwindSafe};
6 
7 // Zero sized marker with the correct set of autotrait impls we want all proc
8 // macro types to have.
9 #[derive(Copy, Clone)]
10 #[cfg_attr(
11     all(procmacro2_semver_exempt, any(not(wrap_proc_macro), super_unstable)),
12     derive(PartialEq, Eq)
13 )]
14 pub(crate) struct ProcMacroAutoTraits(PhantomData<Rc<()>>);
15 
16 pub(crate) const MARKER: ProcMacroAutoTraits = ProcMacroAutoTraits(PhantomData);
17 
18 impl UnwindSafe for ProcMacroAutoTraits {}
19 impl RefUnwindSafe for ProcMacroAutoTraits {}
20