Skip to content

Commit e3b19e5

Browse files
committed
Add test for issue 84666.
1 parent 32ee368 commit e3b19e5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

library/core/tests/any.rs

+13
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,16 @@ fn any_unsized() {
114114
fn is_any<T: Any + ?Sized>() {}
115115
is_any::<[i32]>();
116116
}
117+
118+
#[test]
119+
fn distinct_type_names() {
120+
// https://github.com/rust-lang/rust/issues/84666
121+
122+
struct Velocity(f32, f32);
123+
124+
fn type_name_of_val<T>(_: T) -> &'static str {
125+
type_name::<T>()
126+
}
127+
128+
assert_ne!(type_name_of_val(Velocity), type_name_of_val(Velocity(0.0, -9.8)),);
129+
}

0 commit comments

Comments
 (0)