Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions enumflags_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,18 +334,18 @@ fn gen_enumflags(ast: &mut DeriveInput, default: Vec<Ident>) -> Result<TokenStre
unsafe impl ::enumflags2::_internal::RawBitFlags for #ident {
type Numeric = #repr;

const EMPTY: Self::Numeric = 0;
const EMPTY: <Self as ::enumflags2::_internal::RawBitFlags>::Numeric = 0;

const DEFAULT: Self::Numeric =
const DEFAULT: <Self as ::enumflags2::_internal::RawBitFlags>::Numeric =
0 #(| (Self::#default as #repr))*;

const ALL_BITS: Self::Numeric =
const ALL_BITS: <Self as ::enumflags2::_internal::RawBitFlags>::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) -> <Self as ::enumflags2::_internal::RawBitFlags>::Numeric {
self as #repr
}
}
Expand Down
8 changes: 8 additions & 0 deletions test_suite/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading