From e3b19e5c25d2de305939a5cc73dcbdf3ae64bd94 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Thu, 3 Jun 2021 15:48:33 +0200 Subject: [PATCH] Add test for issue 84666. --- library/core/tests/any.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/library/core/tests/any.rs b/library/core/tests/any.rs index b0dc9903464..b36d6f0d404 100644 --- a/library/core/tests/any.rs +++ b/library/core/tests/any.rs @@ -114,3 +114,16 @@ fn any_unsized() { fn is_any() {} is_any::<[i32]>(); } + +#[test] +fn distinct_type_names() { + // https://github.com/rust-lang/rust/issues/84666 + + struct Velocity(f32, f32); + + fn type_name_of_val(_: T) -> &'static str { + type_name::() + } + + assert_ne!(type_name_of_val(Velocity), type_name_of_val(Velocity(0.0, -9.8)),); +}