about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-06-03 15:48:33 +0200
committerMara Bos <m-ou.se@m-ou.se>2021-06-03 16:13:45 +0200
commite3b19e5c25d2de305939a5cc73dcbdf3ae64bd94 (patch)
tree1777e870a02d7d53866467105861f082b3973ecc
parent32ee368c867d2aa977ebaca79b4b5ed8ed689fa3 (diff)
downloadrust-e3b19e5c25d2de305939a5cc73dcbdf3ae64bd94.tar.gz
rust-e3b19e5c25d2de305939a5cc73dcbdf3ae64bd94.zip
Add test for issue 84666.
-rw-r--r--library/core/tests/any.rs13
1 files changed, 13 insertions, 0 deletions
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<T: Any + ?Sized>() {}
     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>(_: T) -> &'static str {
+        type_name::<T>()
+    }
+
+    assert_ne!(type_name_of_val(Velocity), type_name_of_val(Velocity(0.0, -9.8)),);
+}