Skip to content

Commit

Permalink
improve macro hygiene for generated derives
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbepop committed Mar 24, 2023
1 parent 1fdc4b4 commit 0bdc4f1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion macro/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ fn enum_tag_impl(input: DeriveInput) -> Result<TokenStream2> {
let variant_idents = data.variants.iter().map(|variant| &variant.ident);
Ok(quote! {
const _: () = {
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(
::core::fmt::Debug,
::core::clone::Clone,
::core::marker::Copy,
::core::cmp::PartialEq,
::core::cmp::Eq,
::core::cmp::PartialOrd,
::core::cmp::Ord,
::core::hash::Hash,
)]
pub enum #tag_ident {
#( #variants ),*
}
Expand Down

0 comments on commit 0bdc4f1

Please sign in to comment.