]> git.lizzy.rs Git - rust.git/blobdiff - library/core/tests/any.rs
Rollup merge of #85912 - LingMan:iter_any, r=nagisa
[rust.git] / library / core / tests / any.rs
index b0dc99034644a9fd4ba8b8d380cbc18de2ad09fc..b36d6f0d4040598b0ea86718d0489681d8c19781 100644 (file)
@@ -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)),);
+}