diff --git a/enumflags_derive/src/lib.rs b/enumflags_derive/src/lib.rs index cbdf139..2cdc12e 100644 --- a/enumflags_derive/src/lib.rs +++ b/enumflags_derive/src/lib.rs @@ -334,18 +334,18 @@ fn gen_enumflags(ast: &mut DeriveInput, default: Vec) -> Result::Numeric = 0; - const DEFAULT: Self::Numeric = + const DEFAULT: ::Numeric = 0 #(| (Self::#default as #repr))*; - const ALL_BITS: Self::Numeric = + const ALL_BITS: ::Numeric = 0 #(| (Self::#variant_names as #repr))*; const BITFLAGS_TYPE_NAME : &'static str = concat!("BitFlags<", stringify!(#ident), ">"); - fn bits(self) -> Self::Numeric { + fn bits(self) -> ::Numeric { self as #repr } } diff --git a/test_suite/common.rs b/test_suite/common.rs index 60b2be9..e08e0fc 100644 --- a/test_suite/common.rs +++ b/test_suite/common.rs @@ -29,6 +29,14 @@ enum Default6 { D = 1 << 3, } +#[bitflags] +#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] +#[repr(u8)] +enum AssociatedTypeNameConflict { + Stringy = 1 << 0, + Numeric = 1 << 1, +} + #[test] fn test_ctors() { use enumflags2::BitFlags;