File tree Expand file tree Collapse file tree 3 files changed +15
-19
lines changed
Expand file tree Collapse file tree 3 files changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -135,16 +135,16 @@ fn verify_flag_values<'a>(
135135 & format ! ( "__enumflags_assertion_{}_{}" ,
136136 type_name, variant_name) ,
137137 Span :: call_site ( ) ) ; // call_site because def_site is unstable
138- // adapted from static-assertions-rs by nvzqz (MIT/Apache-2.0)
138+
139139 deferred_checks. push ( quote_spanned ! ( variant. span( ) =>
140140 #[ doc( hidden) ]
141- const #assertion_name: fn ( ) = || {
142- :: enumflags2 :: _internal :: assert_exactly_one_bit_set :: <[ ( ) ; (
141+ const #assertion_name:
142+ < <[ ( ) ; (
143143 ( #type_name:: #variant_name as u64 ) . wrapping_sub( 1 ) &
144144 ( #type_name:: #variant_name as u64 ) == 0 &&
145145 ( #type_name:: #variant_name as u64 ) != 0
146- ) as usize ] > ( ) ;
147- } ;
146+ ) as usize ] as enumflags2 :: _internal :: AssertionHelper >
147+ :: Status as enumflags2 :: _internal :: ExactlyOneBitSet > :: X = ( ) ;
148148 ) ) ;
149149 }
150150 }
Original file line number Diff line number Diff line change @@ -209,8 +209,12 @@ pub mod _internal {
209209
210210 pub struct AssertionSucceeded ;
211211 pub struct AssertionFailed ;
212- pub trait ExactlyOneBitSet { }
213- impl ExactlyOneBitSet for AssertionSucceeded { }
212+ pub trait ExactlyOneBitSet {
213+ type X ;
214+ }
215+ impl ExactlyOneBitSet for AssertionSucceeded {
216+ type X = ( ) ;
217+ }
214218
215219 pub trait AssertionHelper {
216220 type Status ;
@@ -223,9 +227,6 @@ pub mod _internal {
223227 impl AssertionHelper for [ ( ) ; 0 ] {
224228 type Status = AssertionFailed ;
225229 }
226-
227- pub fn assert_exactly_one_bit_set < Assertion : AssertionHelper > ( )
228- where Assertion :: Status : ExactlyOneBitSet { }
229230}
230231
231232// Internal debug formatting implementations
Original file line number Diff line number Diff line change 11error[E0277]: the trait bound `enumflags2::_internal::AssertionFailed: enumflags2::_internal::ExactlyOneBitSet` is not satisfied
2- --> $DIR/multiple_bits_deferred.rs:6:5
3- |
4- 6 | Three = THREE,
5- | ^^^^^ the trait `enumflags2::_internal::ExactlyOneBitSet` is not implemented for `enumflags2::_internal::AssertionFailed`
6- |
7- ::: $WORKSPACE/src/lib.rs:228:34
8- |
9- 228 | where Assertion::Status: ExactlyOneBitSet {}
10- | ---------------- required by this bound in `enumflags2::_internal::assert_exactly_one_bit_set`
2+ --> $DIR/multiple_bits_deferred.rs:6:5
3+ |
4+ 6 | Three = THREE,
5+ | ^^^^^ the trait `enumflags2::_internal::ExactlyOneBitSet` is not implemented for `enumflags2::_internal::AssertionFailed`
You can’t perform that action at this time.
0 commit comments