• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![no_std]
2 #![deny(unsafe_code)]
3 
4 #[macro_use]
5 extern crate static_assertions;
6 
7 use core::ops::Range;
8 
9 trait Tri<A: ?Sized, B: ?Sized, C: ?Sized> {}
10 
11 impl<T, A: ?Sized, B: ?Sized, C: ?Sized> Tri<A, B, C> for T {}
12 
13 assert_impl_all!(u64: Tri<[&'static u8], dyn Tri<dyn Send, dyn Sync, str>, (u16, u16)>);
14 assert_impl_all!(u8: Send, Sync);
15 assert_impl_all!(&'static [u8]: IntoIterator<Item=&'static u8>);
16 assert_impl_all!(Range<u8>: Iterator<Item=u8>);
17 assert_impl_all!([u8]: Send, Sync, AsRef<[u8]>);
18 assert_impl_all!(str: Send, Sync, AsRef<[u8]>,);
19 
20 assert_impl_any!((): Send, Sync);
21 assert_impl_any!((): Send, From<u8>);
22 assert_impl_any!((): From<u8>, From<u16>, Send);
23 
24 #[allow(dead_code)]
25 struct Foo;
26 
27 trait A {}
28 trait B {}
29 trait C {}
30 
31 impl B for Foo {}
32 
33 assert_impl_one!(Foo: A, B);
34 assert_impl_one!(Foo: B, A);
35 assert_impl_one!(Foo: B, C);
36 assert_impl_one!(Foo: C, B);
37 assert_impl_one!(Foo: A, B, C);
38 assert_impl_one!(Foo: B, C, A);
39 assert_impl_one!(Foo: C, A, B);
40