From de97288c5325b331ef0805be16ead1ec73cb3941 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 6 Jul 2023 15:46:03 +0100 Subject: [PATCH] tor-rtmock: statically assert that the macro makes a Runtime impl --- crates/tor-rtmock/src/util.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/tor-rtmock/src/util.rs b/crates/tor-rtmock/src/util.rs index ba006309e..12f3f169b 100644 --- a/crates/tor-rtmock/src/util.rs +++ b/crates/tor-rtmock/src/util.rs @@ -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)