error[E0277]: `Level<2>` cannot be acquired after `Level<5>`
--> tests/compile_fail/wrong_level_order.rs:19:34
|
19 | let (_, _key) = key.lock(&low);
| ---- ^^^^ the trait `LockAfter<Level<5>>` is not implemented for `Level<2>`
| |
| required by a bound introduced by this call
|
= note: locks must be acquired in ascending level order; once a higher-levelled lock is held, lower-levelled locks cannot be acquired for this key
help: the following other types implement trait `LockAfter<Before>`
--> src/level.rs
|
| impl LockAfter<Bottom> for Level<$n> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `Level<2>` implements `LockAfter<Bottom>`
...
| impl LockAfter<Level<$first>> for Level<$rest> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| `Level<2>` implements `LockAfter<Level<0>>`
| `Level<2>` implements `LockAfter<Level<1>>`
...
| / generate_level_impls!(
| | 64,
| | [
| | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
... |
| | );
| |_- in this macro invocation
note: required by a bound in `MutexKey::<'scope, Lvl>::lock`
--> src/key.rs
|
| pub fn lock<'a, L: Lockable<'a>>(self, target: &'a L) -> (L::Guard, MutexKey<'scope, L::MaxLvl>)
| ---- required by a bound in this associated function
| where
| L::MinLvl: LockAfter<Lvl>,
| ^^^^^^^^^^^^^^ required by this bound in `MutexKey::<'scope, Lvl>::lock`
= note: this error originates in the macro `generate_level_impls` (in Nightly builds, run with -Z macro-backtrace for more info)