Debian Codegraph @

debian/rust-vendor/defmt/tests/ui/derive_bound_overflow.rs

raw
1 struct Flavor;
2
3 trait FlavorT {
4 type List<'a, T: 'a + ::defmt::Format>: ::defmt::Format;
5 }
6
7 impl FlavorT for Flavor {
8 type List<'a, T: 'a + ::defmt::Format> = &'a [T];
9 }
10
11 #[derive(defmt::Format)]
12 // #[defmt(bound())] // fixes the compile error
13 enum Flavored<F: FlavorT + 'static> {
14 Str(F::List<'static, Self>),
15 }
16
17 const _: () = {
18 const fn implements_format<T: defmt::Format>() {}
19
20 implements_format::<Flavored<Flavor>>(); // overflow by the compiler, can only be fixed by removing the bound
21 };
22
23 fn main() {}