Skip to content
Prev Previous commit
Next Next commit
Add ui pass test for fixing custom bounds overflow
  • Loading branch information
ascjones committed Jun 14, 2021
commit 3a987993add90c83d783ee75cfe89d1faca16877
22 changes: 22 additions & 0 deletions test_suite/tests/ui/pass_custom_bounds_fix_overflow.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use scale_info::TypeInfo;

#[allow(unused)]
#[derive(TypeInfo)]
// Without this we get `overflow evaluating the requirement `Vec<B<()>>: TypeInfo``.
// The custom bounds replace the auto generated bounds.
#[scale_info(bounds(T: TypeInfo + 'static))]
struct A<T> {
a: Vec<B<T>>,
b: Vec<B<()>>,
marker: core::marker::PhantomData<T>,
}

#[allow(unused)]
#[derive(TypeInfo)]
struct B<T>(A<T>);

fn assert_type_info<T: TypeInfo + 'static>() {}

fn main() {
assert_type_info::<A<bool>>();
}