Skip to content

Instantly share code, notes, and snippets.

@tomjakubowski
Created January 15, 2015 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomjakubowski/b8b15a1987c21907789c to your computer and use it in GitHub Desktop.
Save tomjakubowski/b8b15a1987c21907789c to your computer and use it in GitHub Desktop.
#![feature(on_unimplemented)]
trait TyEq<T> { }
#[rustc_on_unimplemented="{Self} is not type-equal to {T}"]
impl<T> TyEq<T> for T { }
fn static_assert_ty_eq<T: TyEq<U>, U>() { }
fn main(){
static_assert_ty_eq::<u32, i32>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment