summaryrefslogtreecommitdiff
path: root/rust/proc-macro2/marker.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust/proc-macro2/marker.rs')
-rw-r--r--rust/proc-macro2/marker.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/rust/proc-macro2/marker.rs b/rust/proc-macro2/marker.rs
new file mode 100644
index 000000000000..23b94ce6fa85
--- /dev/null
+++ b/rust/proc-macro2/marker.rs
@@ -0,0 +1,17 @@
+use alloc::rc::Rc;
+use core::marker::PhantomData;
+use core::panic::{RefUnwindSafe, UnwindSafe};
+
+// Zero sized marker with the correct set of autotrait impls we want all proc
+// macro types to have.
+#[derive(Copy, Clone)]
+#[cfg_attr(
+ all(procmacro2_semver_exempt, any(not(wrap_proc_macro), super_unstable)),
+ derive(PartialEq, Eq)
+)]
+pub(crate) struct ProcMacroAutoTraits(PhantomData<Rc<()>>);
+
+pub(crate) const MARKER: ProcMacroAutoTraits = ProcMacroAutoTraits(PhantomData);
+
+impl UnwindSafe for ProcMacroAutoTraits {}
+impl RefUnwindSafe for ProcMacroAutoTraits {}