]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #65961 - lcnr:typename_of, r=Dylan-DPC
authorMazdak Farrokhzad <twingoow@gmail.com>
Sat, 23 Nov 2019 01:22:44 +0000 (02:22 +0100)
committerGitHub <noreply@github.com>
Sat, 23 Nov 2019 01:22:44 +0000 (02:22 +0100)
commit0ae4a19cf3f0f8a9b1e5ea9e9307d6968eabf71e
tree56c0560043e512a4f37fb304ff8d99dc27f15afd
parenta449535bbc7912c4adc1bbf2ab2738d0442f212c
parent985e66362f8dc96699e2c621e4a235e8451376d6
Rollup merge of #65961 - lcnr:typename_of, r=Dylan-DPC

add fn type_name_of_val

This function is often useful during testing and mirrors `align_of_val` and `size_of_val`.

# Example

Showing the default type of integers.

```rust
let x = 7;
println!("per default, integers have the type: {}", std::any::type_name_of_val(&x));
```

To my knowledge this can currently not be done without defining a function similar to `type_name_of_val`.
src/libcore/any.rs