Add test for issue 84666.

This commit is contained in:
Mara Bos 2021-06-03 15:48:33 +02:00
parent 32ee368c86
commit e3b19e5c25

View 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)),);
}