summaryrefslogtreecommitdiffstats
path: root/library/core/tests/any.rs
diff options
context:
space:
mode:
Diffstat (limited to 'library/core/tests/any.rs')
-rw-r--r--library/core/tests/any.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/library/core/tests/any.rs b/library/core/tests/any.rs
index 9538b8139..e98dac8d1 100644
--- a/library/core/tests/any.rs
+++ b/library/core/tests/any.rs
@@ -131,6 +131,24 @@ fn distinct_type_names() {
assert_ne!(type_name_of_val(Velocity), type_name_of_val(Velocity(0.0, -9.8)),);
}
+#[cfg(not(bootstrap))]
+#[test]
+fn dyn_type_name() {
+ trait Foo {
+ type Bar;
+ }
+
+ assert_eq!(
+ "dyn core::ops::function::Fn(i32, i32) -> i32",
+ std::any::type_name::<dyn Fn(i32, i32) -> i32>()
+ );
+ assert_eq!(
+ "dyn coretests::any::dyn_type_name::Foo<Bar = i32> \
+ + core::marker::Send + core::marker::Sync",
+ std::any::type_name::<dyn Foo<Bar = i32> + Send + Sync>()
+ );
+}
+
// Test the `Provider` API.
struct SomeConcreteType {