tor-rtmock: statically assert that the macro makes a Runtime impl

This commit is contained in:
Ian Jackson 2023-07-06 15:46:03 +01:00
parent f0168b5220
commit de97288c53
1 changed files with 6 additions and 0 deletions

View File

@ -95,6 +95,12 @@ macro_rules! impl_runtime { {
self.$sleep.allow_one_advance(dur);
}
}
// TODO this wants to be assert_impl but it fails at generics
const _: fn() = || {
fn x(_: impl Runtime) { }
fn check_impl_runtime $($gens)* (t: $SomeMockRuntime) { x(t) }
};
} }
/// Prelude that must be imported to use [`impl_runtime!`](impl_runtime)