|
1 | 1 | error[E0080]: evaluation of constant value failed
|
2 |
| - --> tests/compile/too_many.rs:1:1 |
3 |
| - | |
4 |
| -1 | / bit_struct::bit_struct! { |
5 |
| -2 | | struct TooMany(u16) { |
6 |
| -3 | | a: u8, |
7 |
| -4 | | b: u8, |
8 |
| -5 | | c: bit_struct::u1 |
9 |
| -6 | | } |
10 |
| -7 | | } |
11 |
| - | |_^ attempt to compute `0_usize - 1_usize`, which would overflow |
12 |
| - | |
13 |
| - = note: this error originates in the macro `bit_struct::impl_fields` (in Nightly builds, run with -Z macro-backtrace for more info) |
| 2 | + --> src/lib.rs |
| 3 | + | |
| 4 | + | macro_rules! impl_fields { |
| 5 | + | _- |
| 6 | + | |_| |
| 7 | + | |_| |
| 8 | + | | |
| 9 | + | | |
| 10 | + | | ($on: expr, $kind: ty => |
| 11 | + | | [$($first_field_doc: expr),*], $head_field: ident, $head_actual: ty $(, [$($field_doc: expr),*], $field: ident, $actual: ty)*) => { |
| 12 | + | | $(#[doc=$first_field_doc])* |
| 13 | + | | pub fn $head_field(&mut self) -> bit_struct::GetSet<'_, $kind, $head_actual, {$on - <$head_actual as bit_struct::BitCount>::COUNT}, ... |
| 14 | + | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow |
| 15 | +... | |
| 16 | + | | bit_struct::impl_fields!($on - <$head_actual as bit_struct::BitCount>::COUNT, $kind => $([$($field_doc),*], $field, $actual),*); |
| 17 | + | | ------------------------------------------------------------------------------------------------------------------------------- |
| 18 | + | | | |
| 19 | + | | in this macro invocation (#3) |
| 20 | + | | in this macro invocation (#4) |
| 21 | + | | }; |
| 22 | + | | ($on: expr, $kind: ty =>) => {}; |
| 23 | + | | } |
| 24 | + | | - |
| 25 | + | |_| |
| 26 | + | |_in this expansion of `bit_struct::impl_fields!` (#2) |
| 27 | + | |_in this expansion of `bit_struct::impl_fields!` (#3) |
| 28 | + | in this expansion of `bit_struct::impl_fields!` (#4) |
| 29 | +... |
| 30 | + | / macro_rules! bit_struct { |
| 31 | + | ( |
| 32 | + | $( |
| 33 | + | $(#[doc = $struct_doc:expr])* |
| 34 | +... |
| 35 | + | bit_struct::impl_fields!(<$kind as bit_struct::BitCount>::COUNT, $kind => $([$($field_doc),*], $field, $actual),*); |
| 36 | + | ------------------------------------------------------------------------------------------------------------------ in this macro invocation (#2) |
| 37 | +... |
| 38 | + | }; |
| 39 | + | | } |
| 40 | + | |_- in this expansion of `bit_struct::bit_struct!` (#1) |
| 41 | + | |
| 42 | + ::: tests/compile/too_many.rs:1:1 |
| 43 | + | |
| 44 | +1 | / bit_struct::bit_struct! { |
| 45 | +2 | | struct TooMany(u16) { |
| 46 | +3 | | a: u8, |
| 47 | +4 | | b: u8, |
| 48 | +5 | | c: bit_struct::u1 |
| 49 | +6 | | } |
| 50 | +7 | | } |
| 51 | + | |_- in this macro invocation (#1) |
| 52 | + |
| 53 | +error[E0080]: evaluation of constant value failed |
| 54 | + --> src/lib.rs |
| 55 | + | |
| 56 | + | macro_rules! impl_fields { |
| 57 | + | _- |
| 58 | + | |_| |
| 59 | + | |_| |
| 60 | + | | |
| 61 | + | | |
| 62 | + | | ($on: expr, $kind: ty => |
| 63 | + | | [$($first_field_doc: expr),*], $head_field: ident, $head_actual: ty $(, [$($field_doc: expr),*], $field: ident, $actual: ty)*) => { |
| 64 | + | | $(#[doc=$first_field_doc])* |
| 65 | + | | pub fn $head_field(&mut self) -> bit_struct::GetSet<'_, $kind, $head_actual, {$on - <$head_actual as bit_struct::BitCount>::COUNT}, {$on - 1}... |
| 66 | + | | ^^^^^^^ attempt to compute `0_usize - 1_usize`, which would overflow |
| 67 | +... | |
| 68 | + | | bit_struct::impl_fields!($on - <$head_actual as bit_struct::BitCount>::COUNT, $kind => $([$($field_doc),*], $field, $actual),*); |
| 69 | + | | ------------------------------------------------------------------------------------------------------------------------------- |
| 70 | + | | | |
| 71 | + | | in this macro invocation (#3) |
| 72 | + | | in this macro invocation (#4) |
| 73 | + | | }; |
| 74 | + | | ($on: expr, $kind: ty =>) => {}; |
| 75 | + | | } |
| 76 | + | | - |
| 77 | + | |_| |
| 78 | + | |_in this expansion of `bit_struct::impl_fields!` (#2) |
| 79 | + | |_in this expansion of `bit_struct::impl_fields!` (#3) |
| 80 | + | in this expansion of `bit_struct::impl_fields!` (#4) |
| 81 | +... |
| 82 | + | / macro_rules! bit_struct { |
| 83 | + | ( |
| 84 | + | $( |
| 85 | + | $(#[doc = $struct_doc:expr])* |
| 86 | +... |
| 87 | + | bit_struct::impl_fields!(<$kind as bit_struct::BitCount>::COUNT, $kind => $([$($field_doc),*], $field, $actual),*); |
| 88 | + | ------------------------------------------------------------------------------------------------------------------ in this macro invocation (#2) |
| 89 | +... |
| 90 | + | }; |
| 91 | + | | } |
| 92 | + | |_- in this expansion of `bit_struct::bit_struct!` (#1) |
| 93 | + | |
| 94 | + ::: tests/compile/too_many.rs:1:1 |
| 95 | + | |
| 96 | +1 | / bit_struct::bit_struct! { |
| 97 | +2 | | struct TooMany(u16) { |
| 98 | +3 | | a: u8, |
| 99 | +4 | | b: u8, |
| 100 | +5 | | c: bit_struct::u1 |
| 101 | +6 | | } |
| 102 | +7 | | } |
| 103 | + | |_- in this macro invocation (#1) |
0 commit comments