SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. macro_rules! assert_type_in {
  2.     ($t:ty: $($l:ty),+) => {
  3.         {
  4.             trait InList {}
  5.             $(impl InList for $l {})+
  6.  
  7.             fn in_list<T: ?Sized + InList>() {}
  8.             let _ = in_list::<$t>;
  9.         }
  10.     }
  11. }
  12.  
  13. fn main() {
  14.     assert_type_in!(u8: u8, u16);
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top