From 4dd96d2b0fc87e7081009ab26ba396e3638a4ada Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 9 Aug 2019 20:04:18 +0200 Subject: [PATCH] check against more collisions for TypeId of fn pointer --- src/test/ui/typeid-intrinsic.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/test/ui/typeid-intrinsic.rs b/src/test/ui/typeid-intrinsic.rs index c2611158e65ef..5bc4e0c217f40 100644 --- a/src/test/ui/typeid-intrinsic.rs +++ b/src/test/ui/typeid-intrinsic.rs @@ -78,10 +78,20 @@ pub fn main() { assert_eq!(TypeId::of::(), other1::id_u32_iterator()); assert_eq!(other1::id_i32_iterator(), other2::id_i32_iterator()); assert_eq!(other1::id_u32_iterator(), other2::id_u32_iterator()); - assert!(other1::id_i32_iterator() != other1::id_u32_iterator()); - assert!(TypeId::of::() != TypeId::of::()); + assert_ne!(other1::id_i32_iterator(), other1::id_u32_iterator()); + assert_ne!(TypeId::of::(), TypeId::of::()); // Check fn pointer against collisions - assert!(TypeId::of:: A) -> A>() != - TypeId::of:: A, A) -> A>()); + assert_ne!( + TypeId::of:: A) -> A>(), + TypeId::of:: A, A) -> A>() + ); + assert_ne!( + TypeId::of:: fn(&'a i32) -> &'a i32>(), + TypeId::of:: fn(&'a i32) -> &'static i32>() + ); + assert_ne!( + TypeId::of:: fn(&'a i32, &'b i32) -> &'a i32>(), + TypeId::of:: fn(&'b i32, &'a i32) -> &'a i32>() + ); }