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